I've tried so hard by myself and I've just ended up confusing myself as it's my first time using vb.
I didn't want to waste anyones time but I'm sorry I just don't know what to do..
----

How would I code this?

I want to make a progress bar that runs when a button is clicked.
However there is also a checkbox and textbox that affect the whole thing.

If the checkbox is checked and there are characters in the text box, the button works and starts the progress bar.
If the checkbox isn't checked and/or the textbox is empty, an error message comes up when the button is pressed.

----

I can almost code it but I get stuck at

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If String.IsNullOrEmpty(TextBox1.Text) Then
            Button1.Enabled = False
        Else
            Button1.Enabled = True
        End If

        If CheckBox1.Checked = False Then
            Button1_Click(MsgBox("Error. The checkbox must be ticked"))

As you probably know, that isn't right but I just don't know what to do next :(


Please help thankyou so much.

Hi,

You should try something like this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If CheckBox1.Checked = False Or TextBox1.Text = "" Then
            MsgBox("Error, You forgot something")
        Else
            MsgBox("Progressbar coding goes here")
        End If
    End Sub
commented: to the point answer. +8
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.