Sign in to follow this  
annoyer101

help with simple VB problem

Recommended Posts

Hello. I need some help with a Visual Basic 2005 express program. I've only learned a little about VB so when trying to do something i wasn't 100% sure on i encountered a problem. In other words, this code won't run the program properly: Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim hi As String = TextBox1.Text Dim hey As Boolean = RadioButton1.CanSelect If (hey = False) Then MessageBox.Show(hi) ElseIf (hey = True) Then MessageBox.Show(" ") End If End Sub End Class (this program has a textbox, a button below that, and a radiobutton below that, The button is used to open a messagebox that displays the text in the textbox, and if the radiobutton is selected, the text should not show in the messagebox when the regular button is pressed. However, when I type in the textbox, and press then button, then messagebox will be blank wheter i select the radiobutton or not.) Any help with this problem is greatily appreciated. Thank You.

Share this post


Link to post
Share on other sites
I think the correct method is RadioButton1.Checked :)

Edit: Dim hey As Boolean = RadioButton1.Checked

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this