Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is it possbile to once user selected hes CommPort Number from combobox , it will be saved and when programm will be reruned - value in combobox will be saved, so
.PortName = cboComPort.Text 
will work without pre-selecton

What I have tried:

Dim Portnames As String() = SerialPort.GetPortNames
If Portnames.Length = 0 Then
    MsgBox("Сперва подключите устройство")

    Me.Close()
    Exit Sub
End If
cboComPort.Items.AddRange(Portnames)
cboComPort.Text = Portnames(0)
Posted
Updated 2-Jul-17 23:19pm
v3
Comments
Ralf Meier 30-Jun-17 2:37am    
Of course is it possible.
What you have to do is (because this happens at runtime) to store this selection-value into your own file.
If you re-start your application you should load first those file-Content into your application ...

1 solution

To store simple value you normally use the registry. In this article from Microsoft about Registry.GetValue youfind explanation and some sample code. You must load and save these settings at startup or exit of your program.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900