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.

Recommended Answers

All 5 Replies

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.
commented: Exactly what I was looking for! Excellent +3

yes it did help!! thanks a lot!!

[snipped - new thread here]

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

codeorder-will do, tnx 4 reminder :)

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.