'**************************************
' Name: Sort alphabeticalyLine by Line
' Description:Takes all the selected lin
' es in a textbox and sorts them alphabeti
' caly.
' By: Michael Frey
'
'
' Inputs:None
'
' Returns:None
'
'Assumes:You need one textbox "Text1". O
' ne Combobox "Combo1" and set its sorted
' property to true. One CommandButton "Com
' mand1"
'
'Side Effects:None
'
'Warranty:
'Code provided by Planet Source Code(tm)
' (http://www.Planet-Source-Code.com) 'as
' is', without warranties as to performanc
' e, fitness, merchantability,and any othe
' r warranty (whether expressed or implied
' ).
'Terms of Agreement:
'By using this source code, you agree to
' the following terms...
' 1) You may use this source code in per
' sonal projects and may compile it into a
' n .exe/.dll/.ocx and distribute it in bi
' nary format freely and with no charge.
' 2) You MAY NOT redistribute this sourc
' e code (for example to a web site) witho
' ut written permission from the original
' author.Failure to do so is a violation o
' f copyright laws.
' 3) You may link to this code from anot
' her website, provided it is not wrapped
' in a frame.
' 4) The author of this code may have re
' tained certain additional copyright righ
' ts.If so, this is indicated in the autho
' r's description.
'**************************************
Private Sub Command1_Click()
Combo1.Clear
wrap = Chr(13) + Chr(10)
If Text1.SelText = "" Then
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
Open "c:\curr.txt" For Output As #1
Print #1, Text1.SelText
Close #1
Open "c:\curr.txt" For Input As #1
Do Until EOF(1)
Line Input #1, Ln
Combo1.AddItem Ln
Loop
Close #1
Kill "c:\curr.txt"
Addtext = ""
For x = 0 To Combo1.ListCount - 1
If x <> Combo1.ListCount - 1 Then
Addtext = Addtext + Combo1.List(x) + wrap
Else
Addtext = Addtext + Combo1.List(x)
End If
DoEvents
Next x
Text1.SelText = Addtext
Combo1.Clear
End Sub