Some people make applications that have an Arabic Interface. We cannot name any column in Arabic in any RDBMS, however There are two ways to make an Arabic column in The first way is very easy and can be done by changing the header text of The second way is that Create an instance from Add cells you created to be hosted in Ok, after you add cells to Introduction
DataGridView
can solve this problem by giving an Arabic name to your column when you display your data.Using the Code
DataGridView
.DataGridView
as follows:
aDataGridViewTextBoxColumn
is used to host cells that enable displaying and editing of textstring
s.Steps
DataGridViewTextBoxColumn
classdataGridView1
:dataGridView
, you want to make a link between the cell which you write Arabic text on and the column:Example
History
الأحد، 14 ديسمبر 2008
How to Make an Arabic Column in DataGridView
Collapse
dataGridView1.Columns[0].HeaderText = "???????";
ataGridView1.Columns[1].HeaderText = "?????";
d
taGridView1.Columns[2].HeaderText = "?????";
d Collapse
dataGridView1.Columns.AddRange(new DataGridViewTextBoxColumn[] {
idDataGridViewTextBoxColumn,
nameDataGridViewTextBoxColumn,
ageDataGridViewTextBoxColumn});
Collapse
idDataGridViewTextBoxColumn.DataPropertyName = "id";
idDataGridViewTextBoxColumn.HeaderText = "?";
Collapse
DataGridViewTextBoxColumn idDataGridViewTextBoxColumn;
DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
DataGridViewTextBoxColumn ageDataGridViewTextBoxColumn;
private void Form1_Load(object sender, EventArgs e)
{ idDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
nameDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
ageDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
dataGridView1.Columns.AddRange(new DataGridViewTextBoxColumn[] {
idDataGridViewTextBoxColumn,
nameDataGridViewTextBoxColumn,
ageDataGridViewTextBoxColumn});
using (SqlConnection sqlCon = new SqlConnection(
@"Data Source=.\SQLEXPRESS;AttachDbFilename=" +
"C:\Documents and Settings\Administrator\My Documents\AhmedRabie.mdf;" +
"Integrated Security=True;Connect Timeout=30;User Instance=True"))
{
SqlCommand cmd = sqlCon.CreateCommand();
cmd.CommandText = "Select * from StudentInfo";
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = cmd;
DataSet dset = new DataSet();
adapter.Fill(dset);
idDataGridViewTextBoxColumn.DataPropertyName = "id";
idDataGridViewTextBoxColumn.HeaderText = "?";
idDataGridViewTextBoxColumn.Name = "idDataGridViewTextBoxColumn";
//
// nameDataGridViewTextBoxColumn
//
nameDataGridViewTextBoxColumn.DataPropertyName = "name";
nameDataGridViewTextBoxColumn.HeaderText = "?????";
nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
//
// ageDataGridViewTextBoxColumn
//
ageDataGridViewTextBoxColumn.DataPropertyName = "age";
ageDataGridViewTextBoxColumn.HeaderText = "?????";
ageDataGridViewTextBoxColumn.Name = "ageDataGridViewTextBoxColumn";
dataGridView1.DataSource = dset.Tables[0];
}
}
0 التعليقات:
إرسال تعليق