Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Bruno Montalvan  
#1 Posted : Wednesday, February 5, 2014 5:13:05 PM(UTC)
Bruno Montalvan

Rank: Member

Groups: Registered
Joined: 1/23/2014(UTC)
Posts: 14
Location: Lima

Thanks: 4 times
Hi
For some reason I can't display the column Warehouse in the iGrid.

- This is my combo code...works fine.

Code:
With .Combos.Add("ComboWarehouse")
  While Not rsAlmacen.EOF
     .AddItem sItemText:=rsAlmacen!DescrpWarehouse, vItemValue:=rsAlmacen!IdWarehouse
     rsAlmacen.MoveNext
  Wend
  With .Font
    .name = "Arial Narrow"
    .Size = 10
  End With
 .AutoAdjustWidth
End With


- And this is my warehouse column code, but the field column is "blank". I've noticed that field is sorted in the iGrid....Please help me to show this column correctly with the combo option for edit.

Code:
.AddCol sKey:="DescrpWarehouse", sHeader:="Warehouse", eHeaderAlignH:=igAlignHCenter, lWidth:=50).eAlignH=gAlignHCenter
With .ColDefaultCell("DescrpWarehouse")
 .eAlignV = igAlignVCenter
 .eType = igCellCombo
 .eTypeFlags = igComboBtnFlat
 .sCtrlKey = "ComboWarehouse"
End With

Edited by moderator Wednesday, September 17, 2014 2:33:27 PM(UTC)  | Reason: Igor/10Tec added code formatting, corrected question and set status to 'solved'

Igor/10Tec  
#2 Posted : Thursday, February 6, 2014 1:36:02 PM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,111

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
What do you mean when writing "the field column is blank"? By default the combo button isn't displayed in a combo box cell until you select it - unless you set the ShowControlsInAllCells property to True.

Can you tell us how you populate the DescrpWarehouse column? It would be nice to see a sample we can launch to reproduce the problem.
thanks 1 user thanked Igor/10Tec for this useful post.
Bruno Montalvan on 2/6/2014(UTC)
Bruno Montalvan  
#3 Posted : Thursday, February 6, 2014 1:52:40 PM(UTC)
Bruno Montalvan

Rank: Member

Groups: Registered
Joined: 1/23/2014(UTC)
Posts: 14
Location: Lima

Thanks: 4 times
I mean the field is empty, doesn't show any data.

Code:

Code:
criteRio = "SELECT * FROM table"
Set rsRepuestos = Nothing
rsRepuestos.Open criteRio, cn, adOpenStatic, adLockReadOnly
    
With igRepuestos
        .Clear bRemoveCols:=False
        .FillFromRS rsRepuestos
End With


The button displayed is not the problem. The combobox show the data correctly. But the Grid doesn´t show it.

I attach 2 images, with combo (column is empty), and without combo (column show data correctly)

Almacén = Warehouse

Edited by moderator Friday, February 7, 2014 2:53:55 PM(UTC)  | Reason: Not specified

Bruno Montalvan attached the following image(s):
Without combo (column with data).jpg
With combo (column empty).jpg
Igor/10Tec  
#4 Posted : Friday, February 7, 2014 2:50:00 PM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,111

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
I guess I know why this happens. Look at the following statement you use to add items to your combo:

Code:
.AddItem sItemText:=rsAlmacen!DescrpWarehouse, vItemValue:=rsAlmacen!IdWarehouse


In fact, the rsAlmacen!IdWarehouse expression is not a field value, it is a whole ADODB field object! The Value property is its so called default property that is used implicitly if you assign this expression to another variable of an elementary data type like String or Integer. But in this context the vItemValue argument is Variant, and you store the whole field object in the combo.

If I'm right, the code should look like this:

Code:
.AddItem sItemText:=rsAlmacen!DescrpWarehouse, vItemValue:=rsAlmacen.Fields("IdWarehouse").Value
Bruno Montalvan  
#5 Posted : Friday, February 7, 2014 3:13:09 PM(UTC)
Bruno Montalvan

Rank: Member

Groups: Registered
Joined: 1/23/2014(UTC)
Posts: 14
Location: Lima

Thanks: 4 times
Thanks for responding.
Not working, I still have the problem.

I need edit the table using combobox within the grid.

Do you have an example using the combo with database?.
I use visual basic 6 with acces 2007, ADO connection.

I will appreciated your help.
Igor/10Tec  
#6 Posted : Saturday, February 8, 2014 10:13:39 AM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,111

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
I've looked into all samples we have for VB6 and VBA, but unfortunately I could not find a ready sample with a combo list populated from a db. But in any case, I think, we need to make YOUR sample work. Can you prepare and send us a project that demonstrates the issue to our main support email address?

Edited by user Wednesday, September 17, 2014 2:31:31 PM(UTC)  | Reason: Not specified

Bruno Montalvan  
#7 Posted : Saturday, February 8, 2014 7:24:07 PM(UTC)
Bruno Montalvan

Rank: Member

Groups: Registered
Joined: 1/23/2014(UTC)
Posts: 14
Location: Lima

Thanks: 4 times
I attach a vb6 project, with my example, something I'm doing wrong, please help me.

thanks

Edited by user Saturday, February 8, 2014 7:26:02 PM(UTC)  | Reason: Not specified

File Attachment(s):
Demo_Main.zip (263kb) downloaded 108 time(s).
Igor/10Tec  
#8 Posted : Monday, February 10, 2014 7:22:22 AM(UTC)
Igor/10Tec

Rank: Administration

Groups: Administrators, Forum Moderator
Joined: 1/17/2011(UTC)
Posts: 1,111

Thanks: 15 times
Was thanked: 141 time(s) in 141 post(s)
If I get you right, you need to use the combo list to select a warehouse in the idWarehouse column. Then the corresponding code snippet that creates the column set should look like this:

Code:
.AddCol sKey:="ID", sHeader:="ID", lWidth:=70
.AddCol sKey:="Company", sHeader:="Company", lWidth:=100
.AddCol sKey:="IdWarehouse", sHeader:="IdWarehouse", lWidth:=70
        
With .ColDefaultCell("IdWarehouse")
   .eAlignV = igAlignVCenter
   .eType = igCellCombo
   .eTypeFlags = igComboBtnFlat
   .sCtrlKey = "ComboWH"
End With


It works.
thanks 1 user thanked Igor/10Tec for this useful post.
Bruno Montalvan on 2/10/2014(UTC)
Bruno Montalvan  
#9 Posted : Monday, February 10, 2014 1:17:04 PM(UTC)
Bruno Montalvan

Rank: Member

Groups: Registered
Joined: 1/23/2014(UTC)
Posts: 14
Location: Lima

Thanks: 4 times
Perfect!!!
Thank you so much...
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.