Monday, December 6, 2010
Praveen P.R: Focus to next Control in winform on Enter Key Pres...
Praveen P.R: Focus to next Control in winform on Enter Key Pres...: "Step 1. //Add the funtion in any common class (static class) so the you can access if from any form you added //Send Focus to next Control ..."
Posted by
Praveen P.R
Tuesday, November 23, 2010
C# Datagridview Disable Sorting.
To Disable sorting in DataGridView.Do the following.
To manually disable sorting do the following.
Column1.SortMode = DataGridViewColumnSortMode.NotSortable;
To manually disable sorting do the following.
Column1.SortMode = DataGridViewColumnSortMode.NotSortable;
Posted by
Praveen P.R
Friday, November 5, 2010
What is layered architecture in .net .Three Layer Architecture in C# .NET
Three Teir / Layer Architecture in C# .NET
This is well explained here
Posted by
Praveen P.R
Thursday, November 4, 2010
String.format in c sharp, padding with zeros e.g 1 to 001
If you want to pad zero's in front of a number in c# .Net
i.e for example if the given number is 24 and you need to add zero's in front of if
then you should do the following.
e.g Assuming that it is a number, not a string.
Int a=24;// To 0024
string newStr = String.Format("{0:0000}", 24]);
Output of newStr will be 0024
i.e for example if the given number is 24 and you need to add zero's in front of if
then you should do the following.
e.g Assuming that it is a number, not a string.
Int a=24;// To 0024
string newStr = String.Format("{0:0000}", 24]);
Output of newStr will be 0024
Posted by
Praveen P.R
Thursday, February 4, 2010
Return Dataset or Datatable With SqlDataAdapter C# .Net
using System.Data.SqlClient;
SqlDataAdapter class used with Select Query to return Dataset/DataTabel as needed
e.g.
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 BindCombo
{
public partial class Form1 : Form
{
SqlConnection con;
SqlCommand cmd;
SqlDataAdapter da;
SqlTransaction st;
bool error;
public Form1()
{
InitializeComponent();
con = new SqlConnection("Data Source=Node1;Initial Catalog=ERP;Persist Security Info=True;User ID=12345;Pooling=False;Password=adc");
cmd = new SqlCommand("Select AreaID,AreaCode from Area", con);
try
{
DataSet ds = new DataSet();
da = new SqlDataAdapter(cmd);
da.Fill(ds);
cmbList.DataSource = ds.Tables[0];
cmbList.DisplayMember = "AreaCode";
cmbList.ValueMember = "AreaID";
}
catch
{
error = true;
}
finally
{
//if (error == true) { st.Rollback(); }
//else { st.Commit(); }
}
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(Convert.ToString((int)cmbList.SelectedValue));
}
}
}
SqlDataAdapter class used with Select Query to return Dataset/DataTabel as needed
e.g.
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 BindCombo
{
public partial class Form1 : Form
{
SqlConnection con;
SqlCommand cmd;
SqlDataAdapter da;
SqlTransaction st;
bool error;
public Form1()
{
InitializeComponent();
con = new SqlConnection("Data Source=Node1;Initial Catalog=ERP;Persist Security Info=True;User ID=12345;Pooling=False;Password=adc");
cmd = new SqlCommand("Select AreaID,AreaCode from Area", con);
try
{
DataSet ds = new DataSet();
da = new SqlDataAdapter(cmd);
da.Fill(ds);
cmbList.DataSource = ds.Tables[0];
cmbList.DisplayMember = "AreaCode";
cmbList.ValueMember = "AreaID";
}
catch
{
error = true;
}
finally
{
//if (error == true) { st.Rollback(); }
//else { st.Commit(); }
}
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(Convert.ToString((int)cmbList.SelectedValue));
}
}
}
Posted by
Praveen P.R
Friday, January 15, 2010
C# Disable Datagrid Sorting,How to disable datagridview sorting c#, Enable and Disable Datagridview Sorting
C# Disable Datagridview Sorting,How to disable datagridview sorting c#, Enable and Disable Datagridview Sorting.
Steps:-
To Disable Datagridview Sorting Add Columns then take Edit Column set sortmode property to notsortable
Steps:-
To Disable Datagridview Sorting Add Columns then take Edit Column set sortmode property to notsortable
Posted by
Praveen P.R
Subscribe to:
Posts (Atom)