[Gambas-user] Shell command
Tony Morehen
tmorehen at ...3602...
Mon Aug 7 16:17:46 CEST 2017
Shane,
I can reproduce your crash here on 3.9.2. It's cause is the line:
Settings["Options/stmDevice"] = ComboBox1.Current
If that line is changed to:
Settings["Options/stmDevice"] = ComboBox1.Current.Text
or the simpler, and in my mind preferred:
Settings["Options/stmDevice"] = ComboBox1.Text
The segmentation fault goes away.
So the code that I'd recommend you use (I commented the code changes):
Public sdevices As String
Public Sub SaveOps_Click()
Settings["Options/CCompCLine"] = TextBox1.Text
'to fix the crash
Settings["Options/stmDevice"] = ComboBox1.Text
Settings.Save()
Me.Close
End
Public Sub Form_Open()
Dim d As String
TextBox1.Text = Settings["Options/CCompCLine"]
Shell "stm8flash -l" To sdevices
' fill combobox with devices
'trim gets rid of the trailing "\n"
'moving Split into the loop saves an intermediate, unneeded string creation
For Each d In Split(Trim(sdevices), " ", "", True)
ComboBox1.Add(d)
Next
'index = find selects the saved device
ComboBox1.Index = ComboBox1.Find(Settings["Options/stmDevice"])
End
More information about the User
mailing list