[Gambas-user] Shell command

Shane buster6seven at ...626...
Tue Aug 8 03:43:07 CEST 2017


of cause missed that looking in wrong place

Thanks Tony


On 08/08/17 00:17, Tony Morehen wrote:
> 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
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------ 
>
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list