Form2 Form2 = new Form2();


Form2.StartPosition = FormStartPosition.CenterParent;

this.Hide();

Form2.ShowDialog();

this.Close();
Module:

Option Explicit

Public Function IsInArray(FindValue As Variant, arrSearch As Variant) As Boolean
On Error GoTo LocalError
If Not IsArray(arrSearch) Then Exit Function
If Not IsNumeric(FindValue) Then FindValue = UCase(FindValue)
IsInArray = InStr(1, vbNullChar & Join(arrSearch, vbNullChar) & vbNullChar, _
vbNullChar & FindValue & vbNullChar) > 0
Exit Function
LocalError:
'Justin (just in case)
End Function

Usage:

Private Sub Command1_Click()
Dim x(5) As String

x(0) = 5
x(1) = 100
x(2) = 2000
x(3) = 11
x(4) = 7
x(5) = 1010
MsgBox IsInArray(10, x)
End Sub

Dim rs As ADODB.Recordset
Dim con As New ADODB.Connection
Dim tables() As String
Dim table1, tablename As String
Dim i As Integer
Private Sub Command1_Click()
If con.State = adStateOpen Then
con.Close
End If
con.Open "Provider=SQLOLEDB.1;Data Source=.;Initial Catalog=GMS;Integrated Security=SSPI"
Set rs = New ADODB.Recordset
Set rs = con.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, "TABLE"))

Do Until rs.EOF
'MsgBox rs!table_name
'Combo1.AddItem (rs!table_name)
If table1 = "" Then
table1 = rs!table_name
Else

table1 = table1 & "," & rs!table_name
End If


rs.MoveNext
Loop
rs.Close
tablename = "adcdata"
Set rs = Nothing
tables() = Split(table1, ",")
For i = 0 To UBound(tables()) - 1

If tablename = tables(i) Then
MsgBox "yes"
Else
End If

Next i

MsgBox table1
End Sub

Private Sub Form_Load()
'con.ConnectionString = "provider=microsoft.jet.oledb.4.0;" & " data source=" & App.Path & "\rubberpark.mdb"
End Sub

Dim message, mess As String
Dim sms() As String

Dim sm() As String
Dim lat, lon, d1, d2 As String
Dim lat1, lon1 As Double
Dim lt1, ln1 As Double
Dim u, loc, s, n, msg, ms, tid, tre, mob As String
Dim i As Integer
Dim temp, t, l, g, o, e, result As Double
Dim h() As String
Dim k() As String
Private Sub Combo1_Click()
MSComm1.CommPort = Combo1.Text
End Sub
Private Sub Command1_Click()
If MSComm1.InBufferCount > 0 Then
u = MSComm1.Input
Text1.Text = Text1.Text & us = Mid(u, 2, 4)
n = Mid(u, 13, 1)
If Mid(u, 2, 4) = "CMTI" Then
loc = Mid(u, 13, 1)
MSComm1.Output = "AT+CMGR=" & loc & Chr(13)
Text1.Text = Text1.Text & "AT+CMGR=" & loc & Chr(13)
Text1.Text = MSComm1.Input
message = Text1.Text
'message = "@0996.54553,N,07630.23133449,E,@0968.5172,N,07639.4825,E"
message = "@0997.9844,N,07660.2006,E,@0968.5172,N,07639.4825,E"
sms() = Split(message, "@")
mess = sms(1)
sm() = Split(mess, ",")
lat = sm(0)
convert (lat)
lat1 = resultl
t1 = lat1
d1 = sm(1)
lon = sm(2)
convert (lon)
lon1 = result
ln1 = lon1
d2 = sm(3)
Dim stAppName As String

html code
Dim path As String
Shell """C:\Program Files\Google\Google Earth\GoogleEarth.exe"" ""C:\Program Files\Google\Google Earth\ret.kml"""
End Sub
Private Sub Command2_Click()
MSComm1.Output = "AT+CMGS=" & Chr(34) & "+91" & num & Chr(34) & Chr(13) & "123456FORWARD" & Chr(26)
End Sub
Private Sub Command3_Click()
MSComm1.Output = "AT+CMGS=" & Chr(34) & "+91" & num & Chr(34) & Chr(13) & "123456RIGHT" & Chr(26)
End Sub
Private Sub Command4_Click()
MSComm1.Output = "AT+CMGS=" & Chr(34) & "+91" & num & Chr(34) & Chr(13) & "123456LEFT" & Chr(26)
End Sub
Private Sub Command5_Click()
MSComm1.PortOpen = True
End Sub
Private Sub Command6_Click()
MSComm1.PortOpen = False
End Sub
Private Sub Command7_Click()
MSComm1.Output = "AT+CMGS=" & Chr(34) & "+91" & num & Chr(34) & Chr(13) & "123456PULLY" & Chr(26)
End Sub
Function convert(val As String)
temp = val
h() = Split(temp, ".")
t = h(0)
l = t / 100
n = h(1)
k() = Split(l, ".")
g = k(0)
o = k(1)
e = o + n
result = g + "." + e
End Function
Private Sub Timer1_Timer()
If MSComm1.InBufferCount > 0 Then
Text1.Text = MSComm1.Input
End If
End Sub

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WEIGHBRIDGE1
{
public partial class MonthReport : Form
{
SqlConnection scn = new SqlConnection("Data Source=.;Initial Catalog=Weighingbridge;Integrated Security=True");
public MonthReport()
{
InitializeComponent();
}
private static string mth;
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.Text == "January")
{
mth = "January";
}
if (comboBox1.Text == "February")
{
mth = "February";
}
if (comboBox1.Text == "March")
{
mth = "March";
}
if (comboBox1.Text == "April")
{
mth = "April";
}
if (comboBox1.Text == "May")
{
mth = "May";
}
if (comboBox1.Text == "June")
{
mth = "June";
}
if (comboBox1.Text == "July")
{
mth = "July";
}
if (comboBox1.Text == "August")
{
mth = "August";
}
if (comboBox1.Text == "September")
{
mth = "September";
}
if (comboBox1.Text == "October")
{
mth = "October";
}
if (comboBox1.Text == "November")
{
mth = "November";
}
if (comboBox1.Text == "December")
{
mth = "December";
}
//-------------------------------------------------------------------------------------------- if (mth == "January")
{
Class1.month = "{Transaction.Dateoftransaction} in '1/1/2007' to ' 1/31/2007' ";
}
if (mth == "February")
{
Class1.month = "{Transaction.Dateoftransaction} in ' 1/2/2007' to ' 28/2/2007' ";
}
if (mth == "March")
{
Class1.month = "{Transaction.Dateoftransaction} in ' 1/3/2007' to '31/3/2007' ";
}
if (mth == "April")
{
Class1.month = "{Transaction.Dateoftransaction} in ' 1/4/2007' to '30/4/2007' ";

}
if (mth == "May")
{
Class1.month = "{Transaction.Dateoftransaction} in ' 1/5/2007' to ' 31/5/2007' ";
}
if (mth == "June")
{
Class1.month = "{Transaction.Dateoftransaction} in ' 1/6/2007' to ' 30/6/2007' ";
}
if (mth == "July")
{
Class1.month = "{Transaction.Dateoftransaction} in ' 1/7/2007' to ' 31/7/2007' ";
}
if (mth == "August")
{
Class1.month = "{Transaction.Dateoftransaction} in '1/8/2007' to '31/8/2007' ";
}
if (mth == "September")
{
Class1.month = "{Transaction.Dateoftransaction} in '1/9/2007' to '30/9/2007' ";
}
if (mth == "October")
{
Class1.month = "{Transaction.Dateoftransaction} in '1/10/2007' to '31/10/2007' ";
}
if (mth == "November")
{
Class1.month = "{Transaction.Dateoftransaction} in '1/11/2007' to '30/11/2007' ";
}
if (mth == "December")
{
Class1.month = "{Transaction.Dateoftransaction} in '1/12/2007' to '31/12/2007' ";

}
MonthlyReportPrint mr = new MonthlyReportPrint();
mr.Show();
}
}
}==============================================================================================using System;
using System.Collections.Generic;
using System.Text;using System.Data;
namespace WEIGHBRIDGE1
{
public class Class1
{
public Class1()
{
}
public static string strno;
public static string date;
public static string fdate;
public static string tdate;
public static string month;
public static string billno;
public static string cname;
//public string strno { get; set; }

}
}

========================================================================================using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WEIGHBRIDGE1
{
public partial class MonthlyReportPrint : Form
{
SqlConnection scn = new SqlConnection("Data Source=.;Initial Catalog=Weighingbridge;Integrated Security=True");
public MonthlyReportPrint()
{
InitializeComponent();
}
private void MonthlyReportPrint_Load(object sender, EventArgs e)
{
//scn.Open();
//SqlDataAdapter da = new SqlDataAdapter("select * from [Transaction] ", scn);
//DataSet ds = new DataSet();
//da.Fill(ds);
//CrystalmonthReport cm = new CrystalmonthReport();
//cm.SetDataSource(ds);
//crystalReportViewer1.ReportSource = cm;
crystalReportViewer1.SelectionFormula = Class1.month;
}
}
}=========================================================================================
using System;

using System.Data;

using System.Configuration;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;
using System.Xml;using System.Text;

using System.Security.Cryptography;

using System.IO;using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

string str= Encrypt("Silpa");

SqlConnection con = new SqlConnection("Data Source=INFO-9;Initial Catalog=test;Integrated Security=True");

SqlCommand cmd=new SqlCommand("insert into pwdd values('"+str+"')",con);

con.Open();

cmd.ExecuteNonQuery();

con.Close();

string str1 = Decrypt("88tlfz/eGbtHNKDnXU6gQw==");

}
public static string Decrypt(string TextToBeDecrypted)

{

RijndaelManaged RijndaelCipher = new RijndaelManaged();
string Password = "CSC";

string DecryptedData;
try {

byte[] EncryptedData = Convert.FromBase64String(TextToBeDecrypted);
byte[] Salt = Encoding.ASCII.GetBytes(Password.Length.ToString());

//Making of the key for decryption

PasswordDeriveBytes SecretKey = new PasswordDeriveBytes(Password, Salt);

//Creates a symmetric Rijndael decryptor object.

ICryptoTransform Decryptor = RijndaelCipher.CreateDecryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16));
MemoryStream memoryStream = new MemoryStream(EncryptedData);

//Defines the cryptographics stream for decryption.THe stream contains decrpted data

CryptoStream cryptoStream = new CryptoStream(memoryStream, Decryptor, CryptoStreamMode.Read);
byte[] PlainText = new byte[EncryptedData.Length];

int DecryptedCount = cryptoStream.Read(PlainText, 0, PlainText.Length); memoryStream.Close();

cryptoStream.Close();
//Converting to string

DecryptedData = Encoding.Unicode.GetString(PlainText, 0, DecryptedCount);

}

catch

{

DecryptedData = TextToBeDecrypted;

}

return DecryptedData;

}
public static string Encrypt(string TextToBeEncrypted)

{

RijndaelManaged RijndaelCipher = new RijndaelManaged();

string Password = "CSC";

byte[] PlainText = System.Text.Encoding.Unicode.GetBytes(TextToBeEncrypted);

byte[] Salt = Encoding.ASCII.GetBytes(Password.Length.ToString()); PasswordDeriveBytes SecretKey = new PasswordDeriveBytes(Password, Salt);

//Creates a symmetric encryptor object.

ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16));

MemoryStream memoryStream = new MemoryStream();

//Defines a stream that links data streams to cryptographic transformations CryptoStream cryptoStream = new CryptoStream(memoryStream, Encryptor, CryptoStreamMode.Write);

cryptoStream.Write(PlainText, 0, PlainText.Length);

//Writes the final state and clears the buffer

cryptoStream.FlushFinalBlock();

byte[] CipherBytes = memoryStream.ToArray();

memoryStream.Close();

cryptoStream.Close();

string EncryptedData = Convert.ToBase64String(CipherBytes);
return EncryptedData;

}
}

output:-
C# Source Code:

protected void Page_Load(object sender, EventArgs e)
{
if(! Page.IsPostBack)
Label1.Text = "Page is loaded first time.";
else
Label1.Text = "PostBack operation performed by clicking the link button";

}

output:
C# Source Code:

int HiddenValue;

protected void Button1_Click(object sender, EventArgs e)
{
HiddenValue = Convert.ToInt32(HiddenField1.Value.ToString());
ListBox1.Items.Add("Item " + HiddenValue.ToString());
Label4.Text = HiddenValue.ToString();
HiddenValue = HiddenValue + 1;
HiddenField1.Value = HiddenValue.ToString();
}
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox1.Text = ListBox1.SelectedItem.Text.ToString();
}



output:   


C# Code:
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "You have clicked the button";
TextBox4.Text = "This is a multi line textbox. This is a multi line textbox. This is a multi line textbox. This is a multi line textbox. ";

TextBox3.Text = TextBox2.Text;
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
TextBox1.Text = "The Text is changed.";

}
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Windows.Forms;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;

public partial class msgbox : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
string message = "Do you want to take print?";
string caption = "Maximum Three Prints";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
MessageBoxIcon icon = MessageBoxIcon.Question;
MessageBoxDefaultButton btn = MessageBoxDefaultButton.Button1;
DialogResult result;
result = MessageBox.Show(message, caption, buttons,icon,btn);
if (result == DialogResult.Yes)
{

Label1.Text = "success";

}
else
{
Label1.Text = "Failure";
}

}
}
Source Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;

namespace excel
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=D:\\excel\\excel\\Sample.xls;" + "Extended Properties=Excel 8.0;";

OleDbConnection connection = new OleDbConnection(strConn);

OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn);

DataSet myDataSet = new DataSet();
myCommand.Fill(myDataSet);
dataGrid1.DataSource = myDataSet.Tables[0].DefaultView;



}
}
}
output:




Database connection with MSAcess Database and insert,update,delete,select commands in VB

Output is:
 Source Code is:

Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Combo1_Click()
rs.Open "select * from punch where Card_id='" & Combo1.Text & "' ", con, adOpenDynamic, adLockBatchOptimistic
While rs.EOF = False
Text1.Text = rs(0)
Text2.Text = rs(1)

rs.MoveNext
Wend
rs.Close
End Sub

Private Sub Command1_Click()
rs.Open "select * from punch where Card_id='12'", con, adOpenDynamic, adLockBatchOptimistic
While rs.EOF = False
Text1.Text = rs(0)
Text2.Text = rs(1)
rs.MoveNext
Wend
rs.Close
End Sub

Private Sub Command2_Click()
con.Execute "insert into punch values('" & Text1.Text & "','" & Text2.Text & "')"
MsgBox "inserted"
End Sub

Private Sub Command3_Click()
con.Execute "update punch set User_Name='" & Text2.Text & "' where Card_id='" & Text1.Text & "'"
MsgBox "updated"

End Sub

Private Sub Command4_Click()
con.Execute "delete from punch where Card_id='" & Text1.Text & "'"
MsgBox "deleted"

End Sub

Private Sub Form_Load()
con.ConnectionString = "provider=microsoft.jet.oledb.4.0;" & " data source=" & App.Path & "\pu.mdb"
con.Open
rs.Open "select Card_id from punch", con, adOpenDynamic, adLockBatchOptimistic
While rs.EOF = False
Combo1.AddItem rs(0)
rs.MoveNext
Wend
rs.Close

End Sub

int HiddenValue;

protected void Button1_Click(object sender, EventArgs e)
{
HiddenValue = Convert.ToInt32(HiddenField1.Value.ToString());
ListBox1.Items.Add("Item " + HiddenValue.ToString());
Label4.Text = HiddenValue.ToString();
HiddenValue = HiddenValue + 1;
HiddenField1.Value = HiddenValue.ToString();
}
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox1.Text = ListBox1.SelectedItem.Text.ToString();
}

protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "You have clicked the button";
TextBox4.Text = "This is a multi line textbox. This is a multi line textbox. This is a multi line textbox. This is a multi line textbox. ";

TextBox3.Text = TextBox2.Text;
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
TextBox1.Text = "The Text is changed.";

}


protected void Button1_Click(object sender, EventArgs e)
{
Literal1.Text = "Welcome to ASP.NET 2.0";
}
Html Code is:

asp:HiddenField ID="HiddenField1" runat="Server" Value="Welcome to ASP.NET 2.0"
Visible="False" 

Source Code is:


protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = HiddenField1.Value;
}
Source Code:

protected void Button1_Click(object sender, EventArgs e)
{
if( FileUpload1.HasFile)
{

FileUpload1.SaveAs("C:/projects/" + FileUpload1.FileName);
Label2.Text = "File Uploaded";
}
else
Label2.Text = "No uploaded file";

}