954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

emty textbox problem

hi all!! here's the deal:
i have this code

Sub SaveToTextFile() Handles Button1.Click
        Dim name1 As String = TextBox3.Text
        Dim st1 As String = TextBox1.Text
        Dim st2 As String = TextBox2.Text
        Dim br1 As String = "{"
        Dim br2 As String = "}"
        Dim desck As String = br1 & st1 & br2 & vbNewLine & vbNewLine & st2
        Dim path1 As String = "F:\My Office\foto Database\Descriptions\"
        Dim extension As String = ".txt"
        Dim path As String = path1 & name1 & extension
        Dim objWriter As New System.IO.StreamWriter(path)
        objWriter.Write(desck)
        objWriter.Close()
    End Sub


now all i want to do is make sure that the textboxes wont be empty when i press the button. i tried using loops but it will loop infinitely and won't let me write something to the textbox.

drdream100
Newbie Poster
10 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

See if this helps.

If TextBox1.Text = Nothing OrElse TextBox2.Text = Nothing OrElse TextBox3.Text = Nothing Then
            MsgBox("TextBoxes CANNOT be Empty.", MsgBoxStyle.Critical)
            Exit Sub '// Skip the remaning code in the Sub.
        End If
        '// Save code here.
codeorder
Posting Virtuoso
1,915 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

yes it did help!! thanks a lot!!

drdream100
Newbie Poster
10 posts since Jan 2011
Reputation Points: 10
Solved Threads: 0
 

[snipped - new thread here ]

razree
Newbie Poster
16 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

razree, please start your own thread for your "own" questions.
If you need help doing so, send me a private message.

codeorder
Posting Virtuoso
1,915 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

codeorder-will do, tnx 4 reminder :)

razree
Newbie Poster
16 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: