Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AFK
Starting Member
26 Posts |
Posted - 2005-03-07 : 10:32:50
|
| I am trying to retrive three values in a Shredan Combo box in VB 6.0. Is it possible to do that. I have a sql query in which I select three columns then populate the combobox. My code is.._____________________________________________________________Private Sub sPopCbo()dim field1 as string dim field2 as string So I set them up like..field1 = "Result1 from Sp" --its a name fieldfield2 = "Result2 from Sp"--its a id fieldthen I have sp to retrive result setsql = "{call sp}" --its simple sp in which I select 3 values then i am calling another subroutine to pop the values in combobox..that looks like Call sPopArray(maCboArray(), sSQL, field1,field2)Then I am calling another subroutine that Removes old names and Ids from control. The if statement first checks the type of the control, then deletes the old information.Call cmn_sPopControl(formName, maCboArray(), SSDcombobox)____________________________________________________________----sPopArray---Public Sub cmn_sPopArray(aniNameIdArray() As NAME_ID, sSQL As String, sNameField As String, sIdField As String)Dim rs As rdoResultsetDim iC As IntegerDim lRowCount As Long Set rs = something iC = 0 ReDim aniArray(iCounter) Do Until rs .EOF ReDim Preserve aniArray(iC + 1) aniArray(iC ).sName = rs (field1 ) & "" aniArray(iC ).lId = rs (field2 ) & "" iC = iC + 1 rs.MoveNext Looprs.CloseSet rs= Nothing__________________________________________________________________--sPopControl--Public Sub cmn_sPopControl(fForm As Form, aniNameIdArray() As NAME_ID, cControlName As Control)Dim i As IntegerDim sAddItem As StringIf TypeOf cControlName Is ListBox Then cControlName.Clear If Not globalEmptyArray Then For i = 0 To (UBound(aniNameIdArray) - 1) sAddItem = aniNameIdArray(i).sName cControlName.AddItem sAddItem Next i End If ElseIf TypeOf cControlName Is SSDBCombo Then cControlName.RemoveAll If Not globalEmptyArray Then For i = 0 To (UBound(aniNameIdArray) - 1) sAddItem = gsFLDDELIM & aniNameIdArray(i).sName & gsFLDDELIM & gsFLDSEP & gsFLDDELIM & aniNameIdArray(i).lId & gsFLDDELIM cControlName.AddItem (sAddItem) Next i End If End If________________________________________________________________Can someone help where can I update so my combo box can show three values...Please help...thanks. |
|
|
|
|
|