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.

Hi Yogesh,

Pls Try this


sarr = Split(sInputLine, "^^")

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.