Posts Tagged ‘c#.net’
February 5, 2009
Dynamic creation of controls
Label lbl = new Label();
this.Controls.Add(lbl);
lbl.Name = lblName;
lbl.Text = “Name”;
Udhaya
Pisquare
Simsys
Tags:.Net, c#.net, CSharp, Dynamic controls, How to add controls to a form at runtime, pisquare, Runtime creation of controls, simsys, udhaya, VB.Net
Posted in Uncategorized | Leave a Comment »
December 9, 2008
How to make textbox to allow decimal values in textbox in c#.net windows forms.
private void txtRate_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar) && !(e.KeyChar.Equals('.')))
e.Handled =true;
}
Udhaya
PiSquare
Tags:allow decimal, c#, c# textbox, c#.net, CSharp, Customizing TextBox, decimal in textbox, equals, from controls, iscontrol, isdigit, keychar, keypress, kps, pisquare, udhaya, visual studio 2005, visual studio 2005 controls, vs 2005, windows forms
Posted in c#.net, data binding using c#, data member, data source, dataset, table binding, visual studio 2005, windows forms | Leave a Comment »
November 28, 2008
Binding ComboBox to a table using Stored Procedure
SqlDataAdapter da = new SqlDataAdapter(“StoredProcedureName”,Connection);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add(new SqlParameter(“@Param1”, Value for @Param1));
DataSet ds = new DataSet( );
da.Fill(ds, “TableName”);
dataGridView1.DataSource = ds;
dataGridView1.DataMember = “TableName”;
Binding ComboBox to a table using Command
Connection.Open();
SqlDataAdapter da = new SqlDataAdapter(“select Uname from Table1”, Connection);
DataSet ds = new DataSet( );
da.Fill(ds, “Table1”);
comboBox1.DataSource =ds.Tables[0];
comboBox1.DisplayMember = “Uname”;
Connection1.Close();
Udhaya
PiSquare Soft Solns
Tags:binding combobox to table, c#, c#.net, ComboBox, connection, connection string, CSharp, Data Binding, data member, data source, DataAdapter, dataset, dataset fill, disconnected, Dot Net, kpsco, pisquare, Stored Procedure, udhaya
Posted in .net grid control, ComboBox, connected method for grid control, data binding using c#, data member, data source, database grid, dataset, disconnected method for grid control, how to use stored proceduer in C#.net, MSSQL, mssql stored procedures, Stored Procedures, table binding, visual studio 2005 data binding | Leave a Comment »
November 28, 2008
Executing Stored Procedure in C#
SQLCommand Command = new SqlCommand(“StoredProcedureName”, Connection);
Command.CommandType = CommandType.StoredProcedure;
Command.Parameters.Add(new SqlParameter(“@Param1”, comboBox1.Text));
//@Param1-Var Name you declare in Stored Procedure;comboBox1.Text-Value to be passed for that Var
Command.Parameters.Add(new SqlParameter(“@Param2”, textBox1.Text));
Command.Parameters.Add(new SqlParameter(“@Param3”, dateTimePicker1.Value));
Command.ExecuteNonQuery();
Udhaya
PiSquare
Tags:.Net, .net codes, c#, c# stored procedures, c#.net, CSharp, datetimepicker, Dot Net, How to execute Stored Procedure in C#?, kpsco, MSSQL, mssql stored procedures, pi square, sqlcommand, sqlconnection, sqlparameter, Stored Procedure, udhaya, VB.Net
Posted in .net grid control, c# .net grid control, c#.net grid, c#.net stored procedures, connected method for grid control, dataset, disconnected method for grid control, grid connection string, how to use stored proceduer in C#.net, MSSQL, mssql stored procedures, Stored Procedures, visual studio 2005 grid control | Leave a Comment »
November 1, 2008
First place the DataGridView Control in the form.In the coding add the namespasce
using System.Data.SqlClient;
then initialize SqlConnection to ConnString as public (i.e)next to public Form1( ) {InitializeComponent( );}
SqlConnection con = new SqlConnection(“Your Connection String”);
DataSet ds;
Inside any event such as Form_load or button1_click add the code
SqlDataAdapter da=new SqlDataAdapter(“select * from table1”,con);
ds=new DataSet();
da.Fill(ds,”table1″);
dataGridView1.DataSource=ds;
dataGridView1.DataMember=”table1″;
By
Udhaya
Tags:.Net, .net codes, .net datagrid, .net grid, binding, C Shark, c#, C# data grid, c# database, C# grid, c#.net, connected, connected method, connection string, CSharp, data, Data Binding, data member, data source, DataAdapter, DataGrid, dataset, disconnected, fill, grid, grid control, gridview, MSSQL, namespace, Pi, pisquare, programming, sql data adapter, sql datagrid, sqlconnection, udhaya, VB.Net
Posted in .net grid control, c# .net grid control, c#.net grid, connected method for grid control, data binding using c#, data member, data source, database grid, dataset, disconnected method for grid control, grid connection string, Stored Procedures, visual studio 2005 grid control | Leave a Comment »