.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Subhransu Sekhar Jena
Jean Paul
satyapriyanayak
SP
abhays
Post New Web Links

DataGridView Combo Box Cell with sub menu

Posted By:      Posted Date: October 15, 2010    Points: 0   Category :Windows Application
 

I need to create a column in the datagirdview that functions like a combo box with sub menus. As an example we have a cell that contains modes of transportation, and rather then a single list to select from the user can choose cars and then get a sub menu of car types or they can choose trucks and get a sub menu of trucks to choose from. 

Modes of Transportation
cars -> Volkswagon Rabbit, Volkwagon Dasher, Volkswagon Bug
truck -> Ford F150, Toyota etc . . 

I hope I have explained my problem accurately enough, if anyone has any insights or suggestions I would love to hear them.

-joe-

 

 




View Complete Post


More Related Resource Links

How to make a DataGridView Cell/Column not enterable / selecatble

  
Hi, I am trying to make a Column in a DataGridView non-entaerable (the user should not be able to set focus to the cell neither using the mouse nor the keyboard). I already tried to change the CurrentCell property in the CellStateChanged. But in this event-handler the CurrenCell is the "old" one; setting it to any value doesn't help, because the value is set after calling this procedure. In Delphi there is an event-handler for entering a cell, where you can tell whether the user is allowed to enter a cell. Is there anything comparable in C#? Any other suggestions?

datagridview select cell

  

okay, this is driving me crazy!!!

In my datagridview, on the current row, how do I select/set the focus of a particular cell?  I am already on the row I just want to set the focus to the third cell.

 

after I validate a cetain cell, I want to tab to the next cell

I tried:

 

SendKeys.Send("{TAB}")  and the application stalls

 

I tried:

 

DgvSched.CurrentCell = DgvSched[3, DgvSched.CurrentRow.Index];

and also

DgvSched.CurrentCell = DgvSched[3, e.RowIndex];

and I get the following error:

An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

 

when I remove the above statement the error does not come up.

 

Anybody??!!


 


Find out if DatagridView Cell is Clicked

  

I have 2 grids on a form.

Both grids are binded to object Panel and PanelLines.

If user click first panel grid, the second panel line grid will show the related panel lines.

If the user clicks the panel grid on the same cell again, I want panel line grid to scroll rows as such visible rows hide and bottom rows show up.

The following code does the scrolling part.

dgvPanelItem.FirstDisplayedScrollingRowIndex = dgvPanelItem.DisplayedRowCount(False) - 1
But I need help in finding out, if first grid ( panel grid ) is already clicked or not.

Find out if DatagridView Cell is Clicked

  

I have 2 grids on a form.

Both grids are binded to object Panel and PanelLines.

If user click first panel grid, the second panel line grid will show the related panel lines.

If the user clicks the panel grid on the same cell again, I want panel line grid to scroll rows as such visible rows hide and bottom rows show up.

The following code does the scrolling part.

dgvPanelItem.FirstDisplayedScrollingRowIndex = dgvPanelItem.DisplayedRowCount(False) - 1
But I need help in finding out, if first grid ( panel grid ) is already clicked or not.

Painting/Filling a specific cell using CellPainting event of datagridview

  

Hi,

I am trying to paint a quantity column in data grid with color red, however when I do so cell alignment changes to left. 

Seems like I have to convert e.value to string in order for this to work and when I do that the cell alignment changes.

Quantity column is of type decimal.

Also I would appreciate if you can guide on how i can fill the certain columns in data grid with certain color(for ex. yellow).

 if (this.dtaGridView.Columns[7].Index ==e.ColumnIndex && e.RowIndex >= 0)

      

             {

                 

handle up & down keys while editing a cell in datagridview to affect listbox

  

I have a datagridview. i have overridden some datagridview methods to capture enter key and updown key in a separate class

ProcessDialogKey()

ProcessDataGridViewKey()

i also have a listbox. while i am editing a cell the listbox is being visible and searching in the listbox for what is in the cell's textbox. (i am also able to catch the up down key but from a different class which overrides some methods.)

Now what i need is when i press up and down key the listbox's selected items will change accordingly.

Plz help me to solve it.


DataGridView & Custom cell painting

  

I'm creating a schedule using a datagridview.  The cells in the grid need a lot of special behavour so I created my own Column and Cell classes.  In the Cell.Paint method I draw the cell text in various colors, draw images and lines, depending on data values.

My question is this:  What is the correct order to draw parts of the cell using the DataGridViewPaintParts?  Does it matter?  At present, the display is horrid - sometimes the cells are transparent (I can see what's underneath the application) and the text is scrambled.  A really good example of how to paint a cell would be great!

Thanks


C# Datagridview cell text compare

  

Hi

I have 2 datagridviews on a form and would like to know if it is possible to compare the text in the 2 views and highlight any differences?

For example:

DG1: Cell A1 Text > This is a test

DG2: Cell A1 Text > This iss some test

Is it therefore possible to highlight "iss" , "some" in red and show the corresponding dgv1 text in green?

I have done this with 2 richtextboxes and cannot work out how to do this with datagridview?

Any help with this is most welcome

Thanks in advance


enabling the cursor in a specific cell within a datagridview

  

guys, i have an add record button in my datagridview application

i would like to enable the cursor on the first cell (in the last row) so the user would be able to enter some more information

i created an on click event, and can get and select the last row

but how do i set the cursor inside the specific cell ?

  Private Sub TestButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TestButton.Click
        Dim RowCount As Integer = Me.grdAccountTypes.RowCount - 1
        Me.grdAccountTypes.FirstDisplayedScrollingRowIndex = RowCount
        Me.grdAccountTypes.CurrentCell = grdAccountTypes.Rows(RowCount).Cells(0)
End SUb


how to update cell in datagridview ?

  

hi

i have datagridview that connect to my database (access)

if i stay on any cell and change the value, a see that the value is changed

but when i make refresh i see that the value is back to the original value.

how i can update this cell (without sql query)

i bind dataset to datagridview like this:

dsView = new DataSet();
            adp
= new OleDbDataAdapter("SELECT * FROM Items", Conn);
            adp
.Fill(dsView, "Items");

Presenting Data with the DataGridView Control in .NET 2.0 > Defining Custom Column and Cell

  
in this link u can find the explanation about how to bind image column at run time.

c# 2008 Datagridview numericupdown cell not working properly. Odd layout behaviour

  

Hi all,

Francesco from Italy here, working with MS products since I was professionally born... that's like a century ago or something like that!

This is my 1st post in MSDN forums, so I hope it would be well accepted :)

 

I'm working with datagrdiview and custom numericupdown cell. I started from here

http://msdn.microsoft.com/en-us/library/aa730881(v=vs.80).aspx

So, I downloaded the code attached there, opened the solution with Visual studio 2008, processed the automatic upgrade from 2005 to 2008 and started to play a bit with it.

It works pretty well, since I tried to use it the way you can see in this project

http://www.zshare.net/download/8837656889ff4ca9

What do I do?

- I have a MDI form containing a simple child form 

- the child form has a splitcontainer, containing a treeview in the left panel

- the treeeview has 4 nodes and, clicking node 1 or 2, loads an usercontrol, containing datagridview with the custom numericoupdown object.

It looks great!

But... if you play a bit with the fields, you'll get an odd behaviour.

The first object I interact with works pretty well. The second object (hosted by the other usercontrol) has a funny behaviour... It simply doesn't work properly.

datagridview Cell Edit

  

Hi, I have one big problem.

i have one grid, with dynamic data, i need to make somes lines with ready only, and its ok works if i click with mouse and keyboard, but if i use the delete key, its possible to delete de cell content.

How to disable the key delete if my row or cell is ready only ?

Best Regards

 


Unable to modify cell color in DataGridView (C#)

  

Hi,

I have a Datagridview object contained in a TabPage and which gets its data from a DataTable.

I'd like to modify the background color of some cells under some asumptions. But I only see the value change in my cell, not the color change. If I go into the datagridview object, I can see the color has been modified, it just doesn't appear on the screen. I have tried to invalidate everything.

Thanks.

 

 

 for (int i =0; i<dgViewObject.Rows.Count; i++)
{
  if( (string) dgViewObject.Rows[i].Cells[2].Value == "SELL")
 {  dgViewObject.Rows[i].Cells[2].Value = "SELL TEST";
   dgViewObject.Rows[i].Cells[2].Style.BackColor = Color.Red; 
 }   }

 

 



Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend