0

Hi,
I am new to VB, and still learning. Please help me.
I am developing a simple VB application, in Visual Studio 2010, where in we have to enter values in the fields given. I need to add a REFRESH button, which should act like a clr screen command. When i press that button, all the data fields should go back to its default values or the current values should be cleared.
And I need to know how to connect this app to Outlook, so that it sends out a mail by fetching the data we entered in the fields.

Edited by pritaeas: Moved to VB.NET

3
Contributors
4
Replies
5
Views
4 Years
Discussion Span
Last Post by Netcode
0

What you mean by current values? You can loop though controls and clear the contents.
for example

   For Each cntrl As System.Windows.Forms.Control In Me.Controls
            If cntrl.GetType.ToString = "System.Windows.Forms.TextBox" Then
                cntrl.Text = String.Empty
            End If
        Next

I am clearing all the textbox content to blank in form. Likewise you need to do for all the controls you need.

0

Sorry that I did not explain it properly. The user will be entering some values in the text boxes. Those are the current values I meant. Initialy the text boxes will be empty. So when I click on the Clear All button, which I have added in the form, I want all those values to be deleted and reset the text boxes to it default values, i.e blank.

0

You can also write this way. However, Pgmer's code should work

For Each Ctrl as Control in Me.controls
    if TypeOf(ctrl) is TextBox T
        ctrl.text = " "
    End If 
Next 

`

This article has been dead for over six months. 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.