Click here to Skip to main content
15,917,059 members
Home / Discussions / C#
   

C#

 
GeneralRe: This is a dump question. Pin
Braincrash20-Feb-03 13:33
Braincrash20-Feb-03 13:33 
GeneralDesigner doesn't delete code Pin
crosenbury19-Feb-03 10:53
crosenbury19-Feb-03 10:53 
QuestionMove a Webbrowser to a new window? Pin
Bog19-Feb-03 7:53
Bog19-Feb-03 7:53 
AnswerRe: Move a Webbrowser to a new window? Pin
Stephane Rodriguez.19-Feb-03 11:07
Stephane Rodriguez.19-Feb-03 11:07 
GeneralRe: Move a Webbrowser to a new window? Pin
Bog20-Feb-03 6:55
Bog20-Feb-03 6:55 
GeneralSearching a C# String Pin
vlusardi19-Feb-03 7:29
vlusardi19-Feb-03 7:29 
GeneralRe: Searching a C# String Pin
Chris Austin19-Feb-03 8:19
Chris Austin19-Feb-03 8:19 
GeneralBefore Delete File Event Pin
nissiml19-Feb-03 7:11
nissiml19-Feb-03 7:11 
GeneralRe: Before Delete File Event Pin
Chris Austin20-Feb-03 3:51
Chris Austin20-Feb-03 3:51 
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 

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.