Saturday, September 03, 2005

Learning Visual Basic and C#

Learning Visual Basic with Microsoft Visual Studio .Net is going great.
I have designed few application with Visual basic

  • one of one is just use of Buttons and label .. it just copies the text from one text fiel to another field with a button click.Code is pretty simple.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = TextBox1.Text
End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If (Timer1.Enabled) Then
Button1.Text = "Start Timer"
Timer1.Stop()

Else
startTime = DateTime.Now()
Timer1.Start()
Button1.Text = "Stop Timer"
End If
End Sub
  • Another one is a network browser...
Using visual c#. first select Microsoft WebBrowser from Tool Box and then add a text input field for url and a click button which can be designed as given below.

private void button1_Click_1(object sender, System.EventArgs e)
{
System.Object nullObject = 0;
string str = "";
System.Object nullObjStr = str;
Cursor.Current = Cursors.WaitCursor;
axWebBrowser1.Navigate(textBox1.Text,
ref nullObject, ref nullObjStr, ref nullObjStr, ref nullObjStr);
Cursor.Current = Cursors.Default;

}
You can also add some basic tool bar features as Back ,Refresh,Stop.
You can download executable from here.