TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jyoti Jodha
NA
1.7k
407.2k
how to make textbox values Global Variable in windows form
Jun 22 2017 3:26 AM
private void button1_Click(object sender, EventArgs e)
{
if (txtcgst.Text != "")
GlobalVariable.CGST = Convert.ToDouble(txtcgst.Text);
else
GlobalVariable.CGST = 0.00;
if (txtsgst.Text != "")
GlobalVariable.SGST = Convert.ToDouble(txtsgst.Text);
else
GlobalVariable.SGST = 0.00;
if (txtigst.Text != "")
GlobalVariable.IGST = Convert.ToDouble(txtigst.Text);
else
GlobalVariable.IGST = 0.00;
if (txtsgst.Text == "")
{
MessageBox.Show("Please Provide Details!");
txt_note1.Focus();
return;
}
{
cmd = new SqlCommand("update GSTsetup set Sgst=@Sgst,Cgst=@Cgst,Igst=@Igst ", con);
con.Open();
//cmd.Parameters.AddWithValue("@id", ID);
cmd.Parameters.AddWithValue("@Sgst", txtsgst.Text);
cmd.Parameters.AddWithValue("@Cgst", txtcgst.Text);
cmd.Parameters.AddWithValue("@Igst", txtigst.Text);
cmd.ExecuteNonQuery();
MessageBox.Show("Record Updated Successfully");
con.Close();
}
//this.Close();
}
class GlobalVariable
{
public static double CGST { get; set; }
public static double SGST { get; set; }
public static double IGST { get; set; }
}
Reply
Answers (
3
)
Handle WebBrowser.ShowPrintDialog() close event not SHDocVw
Please convert and give me VBA to C# code.