|
-
Nov 27th, 2002, 05:15 PM
#1
Thread Starter
Junior Member
splitting a string into 2?
hi...i've managed to upload a .txt file into a comboBox and now i'm trying split each line into 2 ,1st part of line goes to comboBox where the 2nd part goes to lbl.text....so far , i can get 1st part shown in comboBox but the 2nd part nowhere to be found..here the code~:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ProductSplit(2) As String
Dim sw As StreamWriter
Dim sr As StreamReader
Dim fileName As String = "E:\...ProductList.txt"
Dim i As Integer
If (File.Exists(fileName)) Then
sr = File.OpenText(fileName)
Do While (sr.Peek <> -1)
LineOfProduct = sr.ReadLine
ProductSplit = Split(LineOfProduct, ",")
cobProduct.Items.Add(ProductSplit(0))
lblUnitPrice.Text = ProductSplit(1)
Loop
Else
MsgBox("file does not exist")
End If
sw.writerLine(fileName)
sw.Close()
also there are 2 other things i'd like to help me out with plezase
1- an error on sw.writerLine(fileName) it says writerLine is not part of system.io.steamwriter.??
2- how do u get indexes or items selected when u select one of them in 2 or 3 listboxes, for instance u want to remove an item u select it, and automaticly its quantity and price get selected as well??
Thank u people in advance..u've been great
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|