PDA

View Full Version : populatinb combo box at runtime



NewsArchive
01-22-2005, 10:18 AM
[Thursday, January 20, 2005 8:24 AM]

hello folks,
My Requirement:

I want to have an combo box and it should get the list of sql servers that
is installed on the network..or on the machine..

The Process i have done:

I wrote a function , that intially list out the MSSQL server
installed..later it takes the server name from the sb5..which the user
enteres..It verifies with this list and returns one or zero
accordingly...based on this return value..I will have loop and asks for the
user to enter a correct sql server name..I have succeded in this..

CALLTHISFUNCTION1 FUNCTION(server)
CODE
open (window1)
?osqlApp{Prop:Create}='SQLDMO.Application'
onames = ?osqlApp{'ListAvailableSQLServers()'}
Loop i=1 To ?osqlApp{onames&'.Count()'}
ServerQ.Name = ?osqlApp{onames&'.Item('&i&')'}
add(Serverq)
!message(server)
!message(serverq)
IF Serverq=server THEN
return 1
end
End

At this point..my requirement is ...I want to have an combo box and this
combo box should get filled up the datas(servers installed in the
network)returned from the clarion that is the dll in run time.Is that
possible.

or do you have anyother method with using the dll to get this work
done.Please do help me. if not atleast tell me how to queue up or populate
the combo box at runtime.

Regards,
padma

NewsArchive
01-22-2005, 10:18 AM
[Thursday, January 20, 2005 11:45 AM]

Hi Padma,

No problem ;-)

1. Please add a variable (e.g. %SERVERLIST%) using Set Variable...
2. Please add another variable (e.g. %SERVERLISTID%) using Set
Variable...
3. Add your Combo Box dialog
4. Add the %SERVERLIST% variable to the "Combo Box Text ID" field
(Combo Box Dialog Properties -> Advanced Tab).
5. Add the %SERVERLISTID% variable to the "Store Selection Results
in Variable" field (Combo Box Dialog Properties -> Advanced Tab).

You can call your DLL before displaying the dialogs (or before
displaying the Combo Box) and pass the list of detected servers
back to the %SERVERLIST% variable. Please use the following form:

|Server1|Server2|Server3|etc.

This will be displayed in the Combo Box as:

Server1
Server2
Server3
etc.

If the user selects Server2, the %SERVERLISTID% variable is set to 2

Now you can use the "Get List Item" function (String Function) to get
the selected server name.

Use the following (String Functions)

Variable : %MYRESULT%
Function : Get Item List - Get item X from string list
String : %SERVERLIST%
Search String: (empty)
X : %SERVERLISTID%
Y : (empty)

The variable %BYRESULT% contains the selected server name now.

Does this help?

Friedrich


--
Friedrich Linder
www.lindersoft.com
Fax: 1.954.252.3910