Click here to Skip to main content
15,920,596 members
Home / Discussions / C#
   

C#

 
QuestionHow do I know MRU Files ? Pin
JeffSayHi9-Jun-03 17:48
JeffSayHi9-Jun-03 17:48 
AnswerRe: How do I know MRU Files ? Pin
Kannan Kalyanaraman9-Jun-03 18:40
Kannan Kalyanaraman9-Jun-03 18:40 
GeneralDotNet Versions Pin
Kant9-Jun-03 17:28
Kant9-Jun-03 17:28 
GeneralRe: DotNet Versions Pin
Kant9-Jun-03 17:30
Kant9-Jun-03 17:30 
GeneralRe: DotNet Versions Pin
Kannan Kalyanaraman9-Jun-03 17:46
Kannan Kalyanaraman9-Jun-03 17:46 
GeneralRe: DotNet Versions Pin
Kant9-Jun-03 17:55
Kant9-Jun-03 17:55 
GeneralRe: DotNet Versions Pin
Kannan Kalyanaraman9-Jun-03 18:16
Kannan Kalyanaraman9-Jun-03 18:16 
GeneralComboBox in DataGrid, shows up but won't drop down when clicked. Pin
krisp9-Jun-03 11:53
krisp9-Jun-03 11:53 
I used Microsoft's way of adding a combobox to a datagrid by just adding a combobox to the datagrid's controls and moving it to the proper row and column when CurrentCellChanged is fired.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q323167

This code they give is in VB.Net, and I assume it works because many people have used it (from reading on forums). However, when I converted it to C# it does not drop down when it is clicked. I do add it to the DataGrid.Controls and it is displayed. I do not think i should have to add events for clicking, the combo box is in the datagrid's controls and should receive the click event itself and drop down. If it works in VB.Net I can't see why it would be any different in C#.

Has anyone ever done their example in C# and got it to work, I know I can make my own DataGridColumnStyle and i have found examples of it that work. But I really like the simplicity of Microsoft's way and the fact that I should be able to just add any control to the datagrid.

Thanks for any help.


<br />
DataColumn editJobNameColumn = new DataColumn( "Job Name", typeof( string ) );<br />
editJobNameColumn.AllowDBNull = false;<br />
editJobNameColumn.Unique = true;<br />
editJobNameColumn.DefaultValue = "";<br />
<br />
DataColumn editJobRateColumn = new DataColumn( "Charge Rate", typeof( decimal ) );<br />
editJobRateColumn.AllowDBNull = false;<br />
editJobRateColumn.DefaultValue = 0.0M;<br />
DataTable editJobsRates = new DataTable( "Jobs" );<br />
editJobsRates.Columns.Add( editJobNameColumn );<br />
editJobsRates.Columns.Add( editJobRateColumn );<br />
<br />
dtvwEditJobs.Table = editJobsRates;<br />
<br />
this.dtgdEditJobs.DataSource = this.dtvwEditJobs;<br />
this.dtgdEditJobs.Click += new System.EventHandler(this.dtgdEditJobs_Click);<br />
this.dtgdEditJobs.CurrentCellChanged += new System.EventHandler(this.dtgdEditJobs_CurrentCellChanged);<br />
this.dtgdEditJobs.Paint += new System.Windows.Forms.PaintEventHandler(this.dtgdEditJobs_Paint);<br />
this.dtgdEditJobs.Scroll += new System.EventHandler(this.dtgdEditJobs_Scroll);<br />
<br />
<br />
<br />
<br />
private void dtgdEditJobs_Paint(object sender, System.Windows.Forms.PaintEventArgs e)<br />
{<br />
	if( dtgdEditJobs.CurrentCell.ColumnNumber == 0 )<br />
	{<br />
		cmbEditJobs.Width = dtgdEditJobs.GetCurrentCellBounds().Width;<br />
	}<br />
}<br />
<br />
<br />
private void dtgdEditJobs_Click(object sender, System.EventArgs e)<br />
{<br />
	cmbEditJobs.Visible = false;<br />
	cmbEditJobs.Width = 0;<br />
}<br />
<br />
<br />
private void dtgdEditJobs_Scroll(object sender, System.EventArgs e)<br />
{<br />
	cmbEditJobs.Visible = false;<br />
	cmbEditJobs.Width = 0;<br />
}<br />
<br />
private void dtgdEditJobs_CurrentCellChanged(object sender, System.EventArgs e)<br />
{<br />
	if( dtgdEditJobs.CurrentCell.ColumnNumber == 0 )<br />
	{<br />
		cmbEditJobs.Visible = false;<br />
		cmbEditJobs.Width = 0;<br />
		cmbEditJobs.Left = dtgdEditJobs.GetCurrentCellBounds().Left;<br />
		cmbEditJobs.Top = dtgdEditJobs.GetCurrentCellBounds().Top;<br />
		cmbEditJobs.Text = ( string )( dtgdEditJobs[ dtgdEditJobs.CurrentCell ] );<br />
		cmbEditJobs.Visible = true;<br />
	}<br />
	else<br />
	{<br />
		cmbEditJobs.Visible = false;<br />
		cmbEditJobs.Width = 0;<br />
	}<br />
}<br />
<br />
private void cmbEditJobs_TextChanged( object sender, System.EventArgs e )<br />
{<br />
	if( dtgdEditJobs.CurrentCell.ColumnNumber == 0 )<br />
	{<br />
		dtgdEditJobs[ dtgdEditJobs.CurrentCell ] = cmbEditJobs.Text;<br />
	}<br />
}<br />
<br />

GeneralLaunch an .exe from aspx page Pin
eggie59-Jun-03 11:13
eggie59-Jun-03 11:13 
GeneralRe: Launch an .exe from aspx page Pin
J. Dunlap9-Jun-03 11:15
J. Dunlap9-Jun-03 11:15 
GeneralRe: Launch an .exe from aspx page Pin
eggie510-Jun-03 4:52
eggie510-Jun-03 4:52 
GeneralRe: Launch an .exe from aspx page Pin
mikelb10-Jun-03 6:11
mikelb10-Jun-03 6:11 
GeneralRe: Launch an .exe from aspx page Pin
Paresh Gheewala9-Jun-03 13:24
Paresh Gheewala9-Jun-03 13:24 
GeneralRe: Launch an .exe from aspx page Pin
puzzlehacker9-Jun-03 15:38
puzzlehacker9-Jun-03 15:38 
GeneralRe: Launch an .exe from aspx page Pin
eggie510-Jun-03 4:50
eggie510-Jun-03 4:50 
GeneralGet Contant of a field in DataGrid with JavaScript. Pin
avsarm9-Jun-03 10:13
avsarm9-Jun-03 10:13 
GeneralAcceptChanges for DataRow Pin
DionChen9-Jun-03 8:34
DionChen9-Jun-03 8:34 
GeneralRe: AcceptChanges for DataRow Pin
Rocky Moore9-Jun-03 9:05
Rocky Moore9-Jun-03 9:05 
GeneralRe: AcceptChanges for DataRow Pin
krisp9-Jun-03 12:28
krisp9-Jun-03 12:28 
GeneralRe: AcceptChanges for DataRow Pin
DionChen9-Jun-03 15:44
DionChen9-Jun-03 15:44 
GeneralRe: AcceptChanges for DataRow Pin
krisp9-Jun-03 16:15
krisp9-Jun-03 16:15 
QuestionExtracting subitems from a listview? Pin
Manster9-Jun-03 8:21
Manster9-Jun-03 8:21 
AnswerRe: Extracting subitems from a listview? Pin
shaunAustin9-Jun-03 9:04
shaunAustin9-Jun-03 9:04 
GeneralRe: Extracting subitems from a listview? Pin
Manster9-Jun-03 10:12
Manster9-Jun-03 10:12 
GeneralRe: Extracting subitems from a listview? Pin
shaunAustin9-Jun-03 12:54
shaunAustin9-Jun-03 12:54 

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.