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.

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.

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.

Then the above code should work fine for you.. give it a try.

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 

`

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.