![]() ![]() ![]() SqlConnection con = new SqlConnection("data source=DESKTOP-F3B3CCJ\SQLEXPRESS database=master uid=sa password=123456 ") Make your Connection globally like below so that you can access it anywhere in the form. Now create a connection string to connect with Database. Now move to window form application ( Form1.cs) and add following namespace in coding window. My default database is master or you can create your own database if you like. Open your Microsoft SQL Server and create a table like as below. Now design your window form application like below form. To show the data in gridview first you need to insert the data in database and then we will perform gridview operation, for that just follow the below Steps.Ĭreate a New window form application in Microsoft Visual Studio C#. Simply gridview represent the data in row and column format. Here you will learn how to show data in gridview?. How to implement hashing concepts in asp.net.How to use virtual keyboard in asp.net for security purpose.How to Add and verify Captcha image in 3 tier architecture in asp.net.How to use secure login page in asp.net with example.Real example of call by value and call by reference in c#.How to use Navigation control in asp.net application.How to implement validation controls in asp.net application.How to create generic handler in asp.net application.How to perform insert ,edit,delete, update and print operation in Grird view control. ![]() How to deploy web services in setup file in asp.net.How to implement transaction concepts on website.Take Print receipt in Windows FormApplication File Handling Real.Add sql Database(.mdf) in Asp.NetApplication.Note-> some code are not shown in the image variable i is declared at class level to preserve the value of i if e.hasmorepages is trueĮ.Graphics.DrawRectangle(Pens.Black, 100, height,, ) Į.Graphics.DrawString(.ToString(), dataGridView1.Font, Brushes.Black, new RectangleF(100, height,, ), str) Į.Graphics.DrawRectangle(Pens.Black, 100 , height,, ) Į.Graphics.DrawString(.ToString(), dataGridView1.Font, Brushes.Black, new RectangleF(100 , height,, ), str) Į.Graphics.DrawRectangle(Pens.Black, 200 , height,, ) Į.Graphics.DrawString(.ToString(), dataGridView1.Font, Brushes.Black, new RectangleF(200 , height,, ), str) Str.Trimming = StringTrimming.EllipsisCharacter Į.Graphics.FillRectangle(Brushes.LightGray, new Rectangle(100, 100,, )) Į.Graphics.DrawRectangle(Pens.Black, 100, 100,, ) Į.Graphics.DrawString(, dataGridView1.Font, Brushes.Black, new RectangleF(100, 100,, ), str) Į.Graphics.FillRectangle(Brushes.LightGray, new Rectangle(100 , 100,, )) Į.Graphics.DrawRectangle(Pens.Black, 100 , 100,, ) Į.Graphics.DrawString(, dataGridView1.Font, Brushes.Black, new RectangleF(100 , 100,, ), str) Į.Graphics.FillRectangle(Brushes.LightGray, new Rectangle(100 100 , 100,, )) Į.Graphics.DrawRectangle(Pens.Black, 100 100 , 100,, ) Str.LineAlignment = StringAlignment.Center Private void printDocument1_PrintPage(object sender, e) Private void Form2_Load(object sender, EventArgs e)ĭa = new SqlDataAdapter("select*from RAM", con) Fore direct printout enable the below code cs(Design) Double click on Preview Button and write the following codes (Form2.cs),which are given below:. Private void button2_Click_2(object sender, EventArgs e) MessageBox.Show("Registration has been successful") Private void button1_Click(object sender, EventArgs e)Ĭon = new SqlConnection("data source=RAMASHANKER-PC Integrated Security=Yes Database=master") ĭa = new SqlDataAdapter("insert into RAM(STUDENT,CLASS,SEX)values('" textBox1.Text "','" textBox2.Text "','" textBox3.Text "')", con) Step6:- Now go back From1 and double click on ' Insert' Button, 'Show Grid View Data' Button and written the code(Form1.cs) ,which are as given below:.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |