Jump to content

Help please.

- - - - -

  • Please log in to reply
3 replies to this topic

#1
himerhen

himerhen

    Newbie

  • Members
  • Pip
  • 2 posts
I'm doing my project and I can't get through with this problem. Where you need to fill up the form (textboxes) and if it's empty there will be a pop-up saying "Please fill up the form" and if they fill up everything it will proceed to the next form. All those command should be in one button. Here's the code, can anyone tell me what to do? and If I'm doing it right. Thanks in advance.

or is there anything you can add to make it more easier.. thanks again! OH BTW I'm using Visual Basic 2008 Express edition.

 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


        TextBox1.Text = ""

        TextBox2.Text = ""

        TextBox3.Text = ""

        TextBox4.Text = ""

        TextBox5.Text = ""

        Dim Message As String

        Message = MsgBox("Please fill up the form.", MsgBoxStyle.Critical, "Confirmation")

    


        TextBox2.Text = TextBox2.Text

        TextBox1.Text = TextBox1.Text

        TextBox3.Text = TextBox3.Text

        TextBox4.Text = TextBox4.Text

        TextBox5.Text = TextBox5.Text



        Dim Message2 As String

        Message2 = MsgBox("Are you sure you want to proceed?", MsgBoxStyle.YesNoCancel, "Confirmation")


        If Message2 = vbYes Then

            Me.Hide()

            Form2.Show()

        ElseIf Message2 = vbNo Then

            Close()

        End If



    End Sub


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
The first thing your code does is clear all the textboxes. Then you tell them to fill the form, then you do nothing, then you ask if they want to proceed.

You need to rethink what you're doing. What does it mean for the form to be filled in? How do you check that?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
himerhen

himerhen

    Newbie

  • Members
  • Pip
  • 2 posts
Sorry about that I think I mixed everything up. What I'm trying to do is simple fill up form where if they entered the needed information it will proceed to the next form but if they leave it empty and clicked the button there will be a pop-up saying "Please fill up the form" I already know how to do that part. But my problem is how can i put both of that command in one button. Is there anyway you can help me with? I hope I explain myself very well.

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Start with details.

What does it mean for the form to be filled in? You need to answer this question in detail. I'm guessing you need the text of each textbox to be a non-empty string.

How do you check that? Hint: an if statement with a bunch of AND's
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users