0

Suppose mine textfile contains the foll. records--
Sunday, July 13, 20086:29:55 PM^^1^^ritu
Sunday, July 13, 20086:29:55 PM^^2^^ritu
Sunday, July 13, 20086:29:55 PM^^3^^ritu
Sunday, July 13, 20086:29:55 PM^^4^^ritu
Sunday, July 13, 20086:29:55 PM^^5^^ritu

Ion Form_Load,I want that in Combobox only date is picked.
My code is as follows-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim sFilename As String
Dim sFileReader As System.IO.StreamReader
Dim sarr() As String
Dim sInputLine As String

sFilename = "C:\test.txt"
If Dir(sFilename.ToString) <> "" Then
sFileReader = System.IO.File.OpenText(sFilename)
sInputLine = sFileReader.ReadLine()
Do Until sInputLine Is Nothing
sarr = Split(sInputLine, "^^")
Me.ComboBox1.Items.Add(sarr(0))

sInputLine = sFileReader.ReadLine()
Loop
End If
End Sub

But with mine code--Same date is added in the Combox 5 times. I want that only dat dates are added in the combobox that have different times. & Dates.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by anoopkh
0

Hi Yogesh,

Pls Try this


sarr = Split(sInputLine, "^^")

if ComboBox1.FindStringExact(sarr(0))=-1 then

Me.ComboBox1.Items.Add(sarr(0))
end if

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.