0

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.

3
Contributors
5
Replies
7
Views
6 Years
Discussion Span
Last Post by razree
Featured Replies
  • See if this helps. [CODE] 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.[/CODE] Read More

1

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.
Comments
Exactly what I was looking for! Excellent
0

[snipped - new thread here]

Edited by Ezzaral: Removed duplicated question and replaced with link.

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.