[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

combobox vb 2005

Posted on 2009-04-16
27
Medium Priority
?
283 Views
Last Modified: 2013-12-26
hello i have a form  products and i have inside the form  5 textbox and 1  combobox (PRODUCT ID is the combobox ) i want to   select a id from the combobox and the details of each number to apperar to all the textboxes.

pls can  u help me
0
Comment
Question by:demoniumz
  • 15
  • 8
  • 2
  • +1
26 Comments
 
LVL 16

Expert Comment

by:HooKooDooKu
ID: 24157528
Create a two dimensional string array to hold all your details...
Dim Details(1 to 5, 1 to ID_COUNT ) as string

Load the details into the Details String for each ID.

Load the Product ID into the combo box, basically for each Product ID do...
combobox.Add( the nth product ID or it's descrition )
...and make sure the combo box is unsorted

On the Click even of the combo box, update the text boxes...
On ComboBox_Clicked()
DIM ID as long
    ID = combobox.listindex
    textbox1.text = Details( 1, ID )
    textbox2.text = Details( 2, ID )
    textbox3.text = Details( 3, ID )
    textbox4.text = Details( 4, ID )
    textbox5.text = Details( 5, ID )
 
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24160312
Create a two dimensional string array to hold all your details...
Dim Details(1 to 5, 1 to ID_COUNT ) as string

Load the details into the Details String for each ID.

Load the Product ID into the combo box, basically for each Product ID do...
combobox.Add( the nth product ID or it's descrition )
...and make sure the combo box is unsorted

 i dont understand these can u explain in more details pls
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24160433
i forget to say that the form is in vb 2005 linked from ms access 2003 and using  binding navigator
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Author Comment

by:demoniumz
ID: 24160687
can u help pls
0
 
LVL 16

Expert Comment

by:HooKooDooKu
ID: 24161613
Oh, VB forms inside of access.

I don't have expericence doing that.  My experiance is in programming in VB6 stand-alone applications.

But still, the key should be updating the text fields on the combobox click event.  When the combo box has been clicked, you interigate which item in the combo box has been selected and update the text boxes accordingly.

The concept behind a 2D array was to load all the data you need into memory.  But given that you are linked to a database, you should have some way from within VB you can access the database values.
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24162123
Anyone know solution for these problem VB 2005 LINKED FROM MS ACCESS OFFICE 2003 pls help
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24162151
And the textbox's are also bind ?
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24162360
Yes  IPAulino
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24162425
are u know the solution to my problem
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24162470
>> are u know the solution to my problem
Maybe :)
You have the combobox bind to the table and the textboxes also ? And have you done that using the wizards or using code ? If you use code please show some.
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24162534
wizard.load the data from dataset to a form  have Product id as combobox thed other text box.
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24162697
so ipaulino?
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24163072
ipaulino ii apreciate your help here in ecperts exchange.so what sooiution you pprefer me
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24163406
So you don't have the textboxes bound, right ?
By the way it's jpaulino :)
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24163727
Here's an example how you can do that.
https://filedb.experts-exchange.com/incoming/ee-stuff/7605-EE_Combobox.zip 
Basically you fill a dataset with all the necessary fields and then you filter that dataset and get the row (datarow) and use that for populate the textboxes.
Check if this helps!
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24165622
i cant open it cause is  Higher version that vb 2005 can u  conevert it to 2005 pls  and uploading
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24165762
I have upload a picture and all my form comment i open the form not all the aplication because is not regnnize the version  but is not work i make mistake can u corect me please Jpaulino:)
Public Class Norders
 
 
 
   
    Private Sub Norders_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'NicolaouDBDataSet.Orders' table. You can move, or remove it, as needed.
        Me.OrdersTableAdapter.Fill(Me.NicolaouDBDataSet.Orders)
        'TODO: This line of code loads data into the 'NicolaouDBDataSet.OrdersDetails' table. You can move, or remove it, as needed.
        Me.OrdersDetailsTableAdapter.Fill(Me.NicolaouDBDataSet.OrdersDetails)
        'TODO: This line of code loads data into the 'NicolaouDBDataSet.Products' table. You can move, or remove it, as needed.
        Me.ProductsTableAdapter.Fill(Me.NicolaouDBDataSet.Products)
        'TODO: This line of code loads data into the 'NicolaouDBDataSet.Suppliers' table. You can move, or remove it, as needed.
        Me.SuppliersTableAdapter.Fill(Me.NicolaouDBDataSet.Suppliers)
        'TODO: This line of code loads data into the 'NicolaouDBDataSet.Orders' table. You can move, or remove it, as needed.
        Me.OrdersTableAdapter.Fill(Me.NicolaouDBDataSet.Orders)
        'TODO: This line of code loads data into the 'NicolaouDBDataSet.Customers' table. You can move, or remove it, as needed.
 
        Me.SuppliersTableAdapter.Fill(Me.NicolaouDBDataSet.Suppliers)
 
        Me.SupplierIDComboBox.SelectedIndex = -1
        Me.SupplierIDComboBox.DropDownStyle = ComboBoxStyle.DropDownList
 
 
    End Sub
 
    Private Sub CustomersBindingNavigator_RefreshItems(ByVal sender As System.Object, ByVal e As System.EventArgs)
 
    End Sub
 
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
 
    End Sub
 
    Private Sub OrdersBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrdersBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.OrdersBindingSource.EndEdit()
        Me.OrdersTableAdapter.Update(Me.NicolaouDBDataSet.Orders)
 
    End Sub
 
    Private Sub CompanyNameTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CompanyNameTextBox.TextChanged
 
    End Sub
 
    Private Sub movenext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles movenext.Click
        OrdersBindingSource.MoveNext()
    End Sub
 
    Private Sub moveprevius_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles moveprevius.Click
        OrdersBindingSource.MovePrevious()
    End Sub
 
    Private Sub movelast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles movelast.Click
        OrdersBindingSource.MoveLast()
    End Sub
 
    Private Sub movefirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles movefirst.Click
        OrdersBindingSource.MoveFirst()
    End Sub
 
    Private Sub addrec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addrec.Click
        OrdersBindingSource.AddNew()
    End Sub
 
    Private Sub delrec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles delrec.Click
        OrdersBindingSource.RemoveCurrent()
    End Sub
 
    Private Sub OrdersBindingNavigator_RefreshItems(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrdersBindingNavigator.RefreshItems
 
    End Sub
 
    Private Sub BackgroundWorker2_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker2.DoWork
 
    End Sub
 
 
 
 
 
    Private Sub SupplierIDComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SupplierIDComboBox.SelectedIndexChanged
        If Me.SupplierIDComboBox.SelectedIndex <> -1 Then
 
            Dim dr As DataRow = Me.NicolaouDBDataSet.Suppliers.Rows.Find(Me.SupplierIDComboBox.SelectedValue)
            If dr IsNot Nothing Then
                Me.ContactNameTextBox.Text = dr.Item(0).ToString
                Me.PhoneNumTextBox.Text = dr.Item(1).ToString
                Me.CompanyNameTextBox.Text = dr.Item(3).ToString
 
            End If
 
        End If
    End Sub
End Class

Open in new window

untitled.PNG
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24165769
I will change to another version, but this is not workign  (the snippet from your code) ?
Do you have all the information you need in the dataset ?

Private Sub SupplierIDComboBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SupplierIDComboBox.SelectedIndexChanged
        If Me.SupplierIDComboBox.SelectedIndex <> -1 Then
 
            Dim dr As DataRow = Me.NicolaouDBDataSet.Suppliers.Rows.Find(Me.SupplierIDComboBox.SelectedValue)
            If dr IsNot Nothing Then
                Me.ContactNameTextBox.Text = dr.Item(0).ToString
                Me.PhoneNumTextBox.Text = dr.Item(1).ToString
                Me.CompanyNameTextBox.Text = dr.Item(3).ToString
 
            End If
 
        End If
    End Sub

Open in new window

0
 
LVL 1

Author Comment

by:demoniumz
ID: 24165799
what a re u mean  in dataset i cant not see the data in combobox. can u make me an example with  ms access database  to fill textboxes One combobox  two textboxes.I dont like to waist your time but is needed in order to continew
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24165810
i am using vb 2005
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24165866
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24165896
not working pls make me a small example i appreciate using vb 2005
untitled2.PNG
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24165921
Check it again ... I think you have open the wrong application. Then name is EE_Combobox2005
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24165963
open i  have the same thing but is not work i make it again tonight now i must go to work thnks man
0
 
LVL 48

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 24166006
FWIW, I was able to open the Solution fine by simply double-clicking the EE_Combobox2005.sln file.

Wayne
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 total points
ID: 24166057
demoniumz,
Ok then try later.
 
Thanks for the input Wayne :)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month19 days, 4 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question