vb.net - VB Read file and set combobox.text value with text file value -
i have configuration file saved values:
com port=com4
baud rate=
bits=
parity=
stop bits=
mode=
crc byte=
when load form read txt file , write values combo box initialize form values.
this code have far:
private sub form2_load(sender object, e eventargs) handles mybase.load dim configfile string dim path string dim writetext string dim configval string() ' msgbox("form load") path = application.startuppath 'configfile = path + "\comconfig.txt" configfile = "c:\users\wlowe\documents\comconfig.txt" ' if' not system.io.file.exists(configfile) = false ' system.io.file.create(configfile).dispose() 'end if ' load configuration values dim objreader new system.io.streamreader(configfile, true) writetext = objreader.readline() comcombo.text = writetext 'msgbox(objreader.readline().tostring) configval = writetext.split("=") msgbox(configval(1)) comcombo.text = configval(1) writetext = objreader.readline() baudratecombo.text = writetext bitscombo.text = objreader.readline() paritycombo.text = objreader.readline() stopbitscombo.text = objreader.readline() modecombo.text = objreader.readline() crccombo.text = objreader.readline() objreader.close() end sub
but when form loaded, values each combo box blank.
any help appreciated.
vb.net combobox text-files
No comments:
Post a Comment