Hello,

How do I repopulate a combobox.

I have 3 comboboxes that I want to populate first.  They are username,
pin, and pc name.  I want to be able to say, if you select a username
then it will change the corresponding pin and pc name.
This uses dbi also.  I havent been able to find any howto's for this.  
perl, v5.8.8 

----Code snip----
$cmbIndiv = $W2->AddCombobox(
                                                                -name
=>      "cmbIndiv",
                                                                -left
=>      110,
                                                                -top
=>      10,
                                                                -height
=>      30,
                                                                -width
=>      150,
                                                                -menu
=>      1,
                                                                -tabstop
=>      1,
        
-ShowDropDown   =>      1,
                                                                -sort
=>      1,
                                                                
);
$cmbFed = $W2->AddCombobox(
                                                                -name
=>      "cmbFed",
                                                                -left
=>      110,
                                                                -top
=>      30,
                                                                -height
=>      30,
                                                                -width
=>      150,
                                                                -menu
=>      1,
                                                                -tabstop
=>      1
                                                                -sort
=>      1,
);
$cmbMach = $W2->AddCombobox(
                                                                -name
=>      "cmbMach",
                                                                -left
=>      110,
                                                                -top
=>      50,
                                                                -height
=>      30,
                                                                -width
=>      150,
                                                                -menu
=>      1,
                                                                -tabstop
=>      1
                                                                -sort
=>      1,
);

---db connect here---
sub cmbIndiv_Change {
        #open connection to Access database
$dbh = DBI->connect('dbi:ODBC:computers.mdb');

# Get selected values COMBOBOXES
#Indiv
$n = $cmbIndiv->GetCurSel();
$Indivname = $cmbIndiv->GetLBText($n);
#fedpin
$o = $cmbFed->GetCurSel();
$fedpin = $cmbFed->GetLBText($0);
#machine name
$p = $cmbMach->GetCurSel();
$machine = $cmbMach->GetLBText($p);
@vars = ($Indivname, $fedpin, $machine);
$sql1 = q/select * from computers where column = ?/;
        
                $sth = $dbh->prepare($sql1);
                $sth->execute(($Indivname));
                my ($username, $pin, $mach);
                        $sth->bind_col(1, \$username);
                        $sth->bind_col(2, \$pin);
                        $sth->bind_col(3, \$mach);
                                while ($sth->fetch) { 
                                #$cmbIndiv->Add($username);
                                $cmbfed->Change($pin);
                                $cmbMach->Change($mach);
                                print STDERR "first arg: $pin in $mach
and $username";
                        }
}

Chris Parker
Network Administration
[EMAIL PROTECTED]
518-486-9508
****************Quote***********************
I strongly recommend that you read "How To Ask Questions The Smart 
way" by Eric Raymond:
http://www.catb.org/~esr/faqs/smart-questions.html.
****************End Quote*******************
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer. 
--------------------------------------------------------
This e-mail, including any attachments, may be confidential, privileged or 
otherwise legally protected. It is intended only for the addressee. If you 
received this e-mail in error or from someone who was not authorized to send it 
to you, do not disseminate, copy or otherwise use this e-mail or its 
attachments.  Please notify the sender immediately by reply e-mail and delete 
the e-mail from your system.

Reply via email to