FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to refresh DBCombo box ?
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
How to refresh DBCombo box ?
Posted: Fri Feb 24, 2006 08:40 AM

Milan,

OK, I think I have found what you are doing. You are using a numeic as the var cVno.

REDEFINE DBCOMBO oVno VAR cVno ID CBNAME OF oDlg

If you pass cVno as a numeric then it is returned as a numeric (but as you stated, not the correct value). Try passing it as a character and it will be returned as a character. Then you have to convert it back to numeric before saving it to your database.

I will take another look to see if I can modify dbcombo so we can use numerics too.
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
How to refresh DBCombo box ?
Posted: Fri Feb 24, 2006 08:58 AM

Milan,

I think I have the solution. See your email.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 115
Joined: Mon Oct 17, 2005 04:42 AM
How to refresh DBCombo box ?
Posted: Fri Feb 24, 2006 10:29 AM
James Bott wrote:Milan,

I think I have the solution. See your email.

James


Dear James,

Yet it works now. It looks like dawn after a long dark night !!!

Thanks a lot.

Milan.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
How to refresh DBCombo box ?
Posted: Fri Feb 24, 2006 12:43 PM

Yeah!

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
How to refresh DBCombo box ?
Posted: Fri Nov 28, 2008 06:20 AM
I have 2 DbCombo's in my App. I need to change the list in DbCombo2 when I change the selection in DbCombo1.

Unfortunately, I am not getting my DbCombo2 refreshed even after trying Refill(), Reset() and Default()

Any help ? Any idea where I have went wrong

My code

This code is called from the ON CHANGE of my DbCombo 1

// Taking data to array from a recordset
oRecSet:MoveFirst()
nBranchId:=oRecSet:Fields("Branch_Id"):Value
Do While !oRecSet:Eof()
	aAdd(aBranchId  ,str(oRecSet:Fields("Branch_Id"):Value,4))
	aAdd(aBranchName,oRecSet:Fields("Branch_Short_Name"):Value)
	oRecSet:MoveNext()
Enddo

// To check whether the array is generated with desired contents
MsgList(aBranchId)   // The array is OK
MsgList(aBranchName) // The array is Ok

// Resetting DbCombo with new array values
oDbCmb2:aItems:=aBranchId
oDbCmb2:aList:=aBranchName

// Resetting DbCombo Values on the fly
oDbCmb2:Refill() 
oDbCmb2:reset() 
oDbCmb2:default() 
oDbCmb2:Refresh()


Regards

Anser
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
How to refresh DBCombo box ?
Posted: Fri Nov 28, 2008 07:14 AM
Dear All,

Problem solved

Instead of

// Resetting DbCombo with new array values
oDbCmb2:aItems:=aBranchId
oDbCmb2:aList:=aBranchName

// Resetting DbCombo Values on the fly
oDbCmb2:Refill()
oDbCmb2:reset()
oDbCmb2:default()
oDbCmb2:Refresh()



I used, just 1 single line code, that solved the problem

oDbCmb2:SetItems(aBranchId, aBranchName)

Continue the discussion