Click here to Skip to main content
15,888,610 members
Home / Discussions / C#
   

C#

 
GeneralMaking GetObject work for LDAP Pin
Atul Kale19-Feb-03 7:00
Atul Kale19-Feb-03 7:00 
GeneralRe: Making GetObject work for LDAP Pin
Richard Deeming20-Feb-03 0:03
mveRichard Deeming20-Feb-03 0:03 
GeneralRe: Making GetObject work for LDAP Pin
Atul Kale20-Feb-03 20:23
Atul Kale20-Feb-03 20:23 
GeneralDisk Quotas C# Pin
daaaaave19-Feb-03 6:32
daaaaave19-Feb-03 6:32 
GeneralCrystal Reports newcomer and Visual Studio Pin
Braulio Dez19-Feb-03 6:07
Braulio Dez19-Feb-03 6:07 
QuestionHow can I save GDI drawings on a form to jpg or gif Files Pin
mosessaur19-Feb-03 5:35
mosessaur19-Feb-03 5:35 
AnswerRe: How can I save GDI drawings on a form to jpg or gif Files Pin
Aboelkhair20-Feb-03 12:45
Aboelkhair20-Feb-03 12:45 
GeneralHelp Please: ComboBox Control in WinForm Datagrid Control Pin
DionChen19-Feb-03 5:08
DionChen19-Feb-03 5:08 
Hi, all:

I am totally stuck, please help. I have a datagrid on the WinForm ( using C# ). I am trying to create a combobox for one of the columns. I use the technique described in MS KB Article 323167 ( coded in VB.NET) and I port the code to C#. It works fine for the existing rows. Whe I click on the * row ( i.e., try to create a new row) on the datagrid. The combobox seems there, but when I click on the down arrow, the combobox does not dropdown. Occasionally, I can get the dropdown, but when I leave the cell, the changed value goes to the previous row ( strange!). The primary key is AutoNumber, when I click on the new row ( with "*" in front of it), I sometime get little pencil in front of the row, but sometimes I do not get it except the autonumber ( almost like it does not treat as a new row ).

Has anyone use this combobox technique and work on the new row successfully? I include the code snippet ( handling the events) here, if you can spot anything I did wrong, please let me know.

Any help is highly appreciated. Thanks in advance.

Dion

************ Code Starts here ***********

private void dataGrid1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
	if ( dataGrid1.CurrentCell.ColumnNumber == 1 )<br />
	{<br />
		cbType.Width = dataGrid1.GetCurrentCellBounds().Width;<br />
	}<br />
}<br />
<br />
private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)<br />
{<br />
	if ( dataGrid1.CurrentCell.ColumnNumber == 1 )<br />
	{<br />
		cbType.Visible = false;<br />
		cbType.Width = 0;<br />
		cbType.Left = dataGrid1.GetCurrentCellBounds().Left;<br />
		cbType.Top = dataGrid1.GetCurrentCellBounds().Top;<br />
		cbType.Text = dataGrid1[dataGrid1.CurrentCell].ToString() + "";<br />
		cbType.Visible = true;<br />
	}<br />
	else<br />
	{<br />
		cbType.Visible = false;<br />
		cbType.Width = 0;<br />
	}		<br />
}<br />
<br />
private void dataGrid1_Scroll(object sender, System.EventArgs e)<br />
{<br />
	cbType.Visible = false;<br />
	cbType.Width = 0;<br />
}<br />
<br />
<br />
private void dataGrid1_Click(object sender, System.EventArgs e)<br />
{<br />
	cbType.Visible = false;<br />
	cbType.Width = 0;<br />
}<br />
<br />
		<br />
private void cbType_TextChanged(object sender, System.EventArgs e)<br />
{<br />
	if ( dataGrid1.CurrentCell.ColumnNumber == 1 )<br />
	{<br />
		cbType.Visible = false;<br />
<br />
		if ( ( dataGrid1[dataGrid1.CurrentCell] + "") == "" )<br />
		{<br />
			SendKeys.Send("*");<br />
		}<br />
<br />
		dataGrid1[dataGrid1.CurrentCell] = cbType.Text;<br />
	}		<br />
}

Generalc# and win CE Pin
Roger Alsing19-Feb-03 2:55
Roger Alsing19-Feb-03 2:55 
GeneralRe: c# and win CE Pin
Stephane Rodriguez.19-Feb-03 3:10
Stephane Rodriguez.19-Feb-03 3:10 
GeneralRe: c# and win CE Pin
Roger Alsing19-Feb-03 23:09
Roger Alsing19-Feb-03 23:09 
GeneralRe: c# and win CE Pin
Stephane Rodriguez.19-Feb-03 23:18
Stephane Rodriguez.19-Feb-03 23:18 
GeneralRe: c# and win CE Pin
sunnytyra7-Oct-09 17:52
sunnytyra7-Oct-09 17:52 
GeneralRe: c# and win CE Pin
TigerNinja_20-Feb-03 4:57
TigerNinja_20-Feb-03 4:57 
GeneralRe: c# and win CE Pin
Furty20-Feb-03 17:45
Furty20-Feb-03 17:45 
GeneralC# Call VC DLL Pin
aoyee19-Feb-03 1:31
aoyee19-Feb-03 1:31 
GeneralRe: C# Call VC DLL Pin
Stephane Rodriguez.19-Feb-03 3:00
Stephane Rodriguez.19-Feb-03 3:00 
GeneralRe: C# Call VC DLL Pin
Anonymous19-Feb-03 11:41
Anonymous19-Feb-03 11:41 
QuestionWhy xml line highlighted yellow in IDE? Pin
Member 9618-Feb-03 16:20
Member 9618-Feb-03 16:20 
AnswerRe: Why xml line highlighted yellow in IDE? Pin
Furty18-Feb-03 16:27
Furty18-Feb-03 16:27 
GeneralRe: Why xml line highlighted yellow in IDE? Pin
Member 9618-Feb-03 16:40
Member 9618-Feb-03 16:40 
GeneralRe: Why xml line highlighted yellow in IDE? Pin
Atul Kale19-Feb-03 7:19
Atul Kale19-Feb-03 7:19 
GeneralRe: Why xml line highlighted yellow in IDE? Pin
Member 9619-Feb-03 12:12
Member 9619-Feb-03 12:12 
GeneralRe: Why xml line highlighted yellow in IDE? Pin
David Stone19-Feb-03 12:02
sitebuilderDavid Stone19-Feb-03 12:02 
GeneralRe: Why xml line highlighted yellow in IDE? Pin
Member 9619-Feb-03 12:16
Member 9619-Feb-03 12:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.