remounting as read/write -- will I lose my data?
169
No you don't need to. But of course you should make backups from time to time.
Related videos on Youtube
Author by
Modrisco
Updated on September 18, 2022Comments
-
Modrisco over 1 year
Receiving introductory programming lectures in VB studio 2013. I decided to try out a list box for myself on the side and having difficulty coding it, here is the code I have:
Toppingsselected = This is the name for the list box
Pepperoni = name for the check box
Ham = name for the 2nd check box
Private Sub Small_CheckedChanged(sender As Object, e As EventArgs) Handles Pepperoni.CheckedChanged, Ham.CheckedChanged If Pepperoni.Checked = True Then toppingsselected.Items.Add("Pepperoni") Else toppingsselected.Items.Remove("Pepperoni") End If If Ham.Checked = True Then toppingsselected.Items.Add("Ham") Else toppingsselected.Items.Remove("Ham") End If End Sub
Basically, when check and uncheck "pepperoni", it adds and removes "pepperoni" text to and from the list box, but when I check "Ham" it adds pepperoni and ham to the list box.
Apologies if I'm not down with the lingo, just a beginner here, if someone could tell me where I'm going wrong I'd be grateful
-
LarsTech about 8 yearsYou have the same code for both handlers. Separate them into different methods. Or inspect the sender object to see which checkbox control is causing the event, and only act on that one.
-
Shukri Gashi about 8 yearsYour sub is going to be executed every time you check or uncheck each of checkboxes. When you check ham then it will run code. In the first if it controles the state of first checkbox and it is checked, so it pushes peperoni text into listbox. Then it continues to see if second checkbox is checked and this is true also so adds the ham text also to listbox.
-
Charles May about 8 yearsyou could also just cleari the listbox right before your first IF statement. However, if other code manipulates this listbox doing so will not work.
-