Hi guys. I wanted to have a winGrid with only two columns. The first of these columns would be normal and then the second would be a combo. I fill my WinGrid with a data table as follows:
DtUnits Dim As New DataTable ("dtUnits") dtUnits. Columns.Add ("Data") dtUnits. Columns.Add ("Unit") While dateB <dateF Dim row As DataRow = dtUnits.NewRow () row (0) = dateB 'Date mm / dd / yyyy row (1) = "I want COMBO HERE BASED ON another DataTable" dtUnits.Rows.Add (row) dateB = DateAdd (DateInterval.Day, 1, CDate (dateB)) end While Me.GRID.DataSource = dtUnits The combo would serve to enter the unit available on that date, then the combos would be different. I would have units available at a date and unavailable elsewhere. I inserted the code "e.Layout.Bands (0). Columns (" Unit "). ColumnStyle.DropDownList = Style" at the event InitializeLayout
Hi,
What part of this is giving you trouble?
Here are a couple of links that might help:
HOWTO:What is the best way to place a DropDown list in a grid cell?
Creating a dropdown list in a grid cell whose list values are dependent on another cell - Windows Forms - Infragistics Community
I need to fill a datatable with a sql statement to combo line. combo of each grid will have different values. At home the picture below for example. In one day need to show some units and other units on another day. I do not need filtering. I need to fill again with a datatable.
I could populate the grid of my combos with a sql statement for each combo. More still face problem, for example, whenever I return the item to a combo and the combo lose the focus back to the original value.
with this code below in the event InitializeRow I could change the items in combo with no problems. It happens every combo starts empty, no value. I need her to have the first selected item.
Dim objValueList As New Infragistics.Win.ValueListabrirBDMain() 'SUB FOR OPEN DATABASEsql = "SQL INSTRUCTION"RS.Open(sql, BDMain, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly)While Not RS.EOF objValueList.ValueListItems.Add(RS("IDuh").Value, RS("nomeQuarto").Value) RS.MoveNext()End WhileRS.Close()fecharBDMain() 'SUB FOR CLOSE DATABASE
e.Row.Cells("Unidade").ValueList = objValueList
A ValueList does not have a Value, the Value comes from the grid cell. So you will have to set the cell's Value to the Value of some item on the list.
You also have to make sure that the values in your ValueList are the same DataType as the grid column.
I really need help. I can not solve my problem. The screen that you see below. I put the date of checkin and checkout date and type of unit that I seek. By clicking the button I need to show in grid units available for the selected type the date in question.
So what i am doing in the button click event: I create a DataTable with the columns Date and Unit, then in a while with the check-in and check-out date I added the rows.
what better way to do that this way of working ?
Dim dt As New DataTable("dt")dtUnidadesReserva.Columns.Add("Date")dtUnidadesReserva.Columns.Add("Unit")While CDate(DCheckin) < (DCheckout) Dim row As DataRow = dtUnidadesReserva.NewRow() row(0) = DCheckin row(1) = HERE NEED A COMBO dt .Rows.Add(row) DCheckin= DateAdd(DateInterval.Day, 1, CDate(DCheckin))End WhileMe.appGridUnidadesReserva.DataSource = dt
Dim dt As New DataTable("dt ") dtQuartoVago.Columns.Add("idUnit")dtQuartoVago.Columns.Add("Unit")### sub to open the connection to the databasesql = "SQL instruction"RS.Open(sql, BDMain, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly)While Not RS.EOF Dim row As DataRow = dt.NewRow() row(0) = RS("idUnit").Value row(1) = RS("Unit").Value dt.Rows.Add(row) 'RS.MoveNext()End WhileRS.Close()### sub to close connection to the database
I'm sorry, I am trying very hard to understand you, but I still do not know what you are asking.
It now seems like you just want to attach a Combo to the grid column for the Unit. This is very easy, but you cannot do it on the DataTable, it has to be done on the grid. You must create a ValueList or an UltraDropDown, bind it to the list of the possible units, and then attach it the the column (or the cell if you prefer) via the ValueList property.