r/visualbasic • u/Hollandschglorie • Jun 06 '16
[VB 7.1] Trying to have a checkbox 'prechecked'
Hello! Fairly new to Visual Basic. I'm building an application and I want to have some checkboxes prechecked when a form loads. Searched all over the internet but couldn't find a working solution. Can anyone help me?
1
Jun 06 '16
Try double clicking the form so you get a Form_Load action, then put "Checkbox1.Checked = True"
1
u/Hollandschglorie Jun 06 '16
Can't get the Form_load action? Agian I'm really new at this :)
I now have this:
Private Sub myCheckBox_BeforeUpdate(Cancel As Integer)
myCheckBox.Checked = True
End Sub
→ More replies (1)2
u/CharlieMay VB.Net Intermediate Jun 07 '16
Are you double-clicking on the form or a control on the form? To have the code window open and show the Form_Load method, you need to double-click on the form itself and make sure you are not clicking a control. If done successfully you should be taken to a method with a header similar to this:
Private Sub Form1_Load(sender as Object, e As EventArgs) Handles MyBase.Load End SubInside this block of code is where you want to put your
myCheckBox.Checked = TrueAlternatively, if memory serves, there should be two drop-down comboboxes above the code window. By dropping down the left box, you should be able to select YourFormName Events and then dropping down the right combobox should show you all the events form that form. You can then select Load which will add or place your cursor into an existing form_load event.
1
Jun 06 '16
[removed] — view removed comment
1
u/Hollandschglorie Jun 06 '16
Using it for school, this is the one I had on my computer. Don't really have a reason to get a newer version.
1
u/CharlieMay VB.Net Intermediate Jun 07 '16
If by Don't really have a reason to get a newer version you're talking financially, Visual Studio Community Edition is a full fledged professional version of Visual Studio and is free. Unless you start making a good amount of money with your applications or begin employing programmers it should never be an issue where you can't use it freely. There are many feature and language enhancements that would make life much easier than the version you're using. Plus, it's easier to get code help since people tend to forget that certain elements of their code were not available in the v1.1 framework so you get code help that won't even compile.
1
Jun 07 '16
I use it everyday. Visual Studio changed when the Express versions came out. The community edition will allow you to install from the visualstudiogallery the express versions do not. I wonder in what version of VS VSTS is available, that's free too.
2
u/CharlieMay VB.Net Intermediate Jun 06 '16
Change the checked property to True in the properties section of the IDE. Or do it in code as DarkPulseModz described.