Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Populate Custom Dialog Combo Box Items via VBS


2 replies to this topic

mario

mario
  • Members
  • 2 posts

Posted 04 December 2001 - 00:25

I am looking for a way to add a bunch of values to the Items of a Combo Box within a Custom Dialog.

I have not problems reading or setting properties from VBS, but since the actual Items are not populated from a property I am stuck.

Any Ideas?


Murali

Murali
  • Members
  • 18 posts

Posted 06 December 2001 - 09:34

I have a sample code for populating a list box.
Please check whether it will be helpful. Probably you've to modify the table name from ListBox to ComboBox.


Public Function AppendListBox ()
Dim oDatabase
Dim oView
Dim oInstaller

Dim oRecord
Dim intCount
Dim oRecordErr

On Error Resume Next

Set oDatabase = Session.Database

Set oView = oDatabase.OpenView("SELECT * FROM ListBox")

If oView Is Nothing Then
Set oDatabase = Nothing
Exit Function
End If

   Set oInstaller = Session.Installer

'Each record will have four columns. First is the property, second an id
'third to the value and the fourth to the key
Set oRecord = oInstaller.CreateRecord(4)

If Not oRecord Is Nothing Then
'Set the property of the control to which the records are to be attached
oRecord.StringData(1) = "ACTIVESERVERS"
oRecord.IntegerData(2) = id '(integer)
oRecord.StringData(3) = "value"
oRecord.StringData(4) = "key"
End If

On Error Resume Next
'Read/Write on to the view
oView.Modify 7,oRecord

Set oRecord = Nothing

Set oRecordErr = oInstaller.LastErrorRecord

If Not oRecordErr Is Nothing Then
For intCount = 0 to oRecordErr.FieldCount
ShowError oRecordErr.StringData & " " & oRecordErr.IntegerData
Set oRecordErr = Nothing
Exit Function
Next
End If

oView.Close
Set oView = Nothing
Set oDatabase = Nothing
Set oInstaller = Nothing
Set oRecord = Nothing
Set oRecordErr = Nothing

End Function    


mario

mario
  • Members
  • 2 posts

Posted 06 December 2001 - 20:49

Thanks!

I came pretty close yesterday, but instead of using CreateRecord - I tried to fetch one and modify it but then Modify threw an error - probably because of primary key overlaps.

BTW. InstallShield support has notfied me that populating ComboBoxes and Listboxes dynamically is impossible. I am glad you added the last missing piece in my puzzle.

Many Thanks!