473,320 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ComboBox has to be selected TWICE to generate data results on bound fields of labels

2
Hello,
I have a two tables in my database (Customer, Transaction) which are related using the CustomerID. I have dragged and dropped the fields of Customer on my form using Visual Studio tools. When I select a different customer using the combo menu cboCustomer the fields of the Customer such as (name, last name, telephone) get updated. However, the fields related to the particular customer on the Transaction fields i.e. TransactionID, description etc are not.
Now, if I select the same customer TWICE, then the fields of Transaction are displayed.

What I'm I doing wrong?

Thanks!
Mar 7 '13 #1
2 1571
Rabbit
12,516 Expert Mod 8TB
It would help to see the code.
Mar 7 '13 #2
nectar
2
Hi Rabbit. I have dragged and dropped the controls from the data sources. This is what I have in the form load event and selected index change methodd of the cboCustomerName:


Expand|Select|Wrap|Line Numbers
  1.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  2.         'TODO: This line of code loads data into the 'DbPBDataSet.Customer' table. You can move, or remove it, as needed.
  3.         Me.CustomerTableAdapter.Fill(Me.DbPBDataSet.Customer)
  4.         'TODO: This line of code loads data into the 'DbPBDataSet.Employee' table. You can move, or remove it, as needed.
  5.         Me.EmployeeTableAdapter.Fill(Me.DbPBDataSet.Employee)
  6.  
  7.  
  8.         grpDealerSessions.Enabled = False
  9.         grpTables.Enabled = False
  10.         lblSessionIDRes.Text = "No Running Session"
  11.         'TODO: This line of code loads data into the 'DbPBDataSet.Session' table. You can move, or remove it, as needed.
  12.         Me.SessionTableAdapter.Fill(Me.DbPBDataSet.Session)
  13.  
  14.  
  15.         'TODO: This line of code loads data into the 'DbPBDataSet.DealerSessions' table. You can move, or remove it, as needed.
  16.         Me.DealerSessionsTableAdapter.Fill(Me.DbPBDataSet.DealerSessions)
  17.  
  18.  
  19.         'TODO: This line of code loads data into the 'DbPBDataSet.Game' table. You can move, or remove it, as needed.
  20.         Me.GameTableAdapter.Fill(Me.DbPBDataSet.Game)
  21.  
  22.         lblDateTime.Text = Now.ToString
  23.         'TODO: This line of code loads data into the 'DbPBDataSet.Transaction' table. You can move, or remove it, as needed.
  24.         ' Me.TransactionTableAdapter.Fill(Me.DbPBDataSet.Transaction)
  25.  
  26.  
  27.     End Sub
  28.  
  29. ----------------
  30.  
  31. Private Sub cboCustomerName_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboCustomerName.SelectedIndexChanged
  32.         Try
  33.  
  34.             Dim iCountBuyins, iSumBuyins, iSumCashouts, iBiggestWin, iBiggestLoss As Integer
  35.  
  36.             Thread.CurrentThread.CurrentCulture = New CultureInfo("el-GR", False)
  37.             Me.TransactionTableAdapter.FillByCustID(Me.DbPBDataSet.Transaction, CType(lblCustomerID.Text, Integer))
  38.  
  39.             iSumBuyins = CType(TransactionTableAdapter.scalarTotalBuyin(lblCustomerID.Text), Integer)
  40.             lblSumBuyins.Text = iSumBuyins
  41.  
  42.  
  43.             iCountBuyins = CType(TransactionTableAdapter.scalarCountbuyins(lblCustomerID.Text), Integer)
  44.             lblSumBuyins.Text = iCountBuyins
  45.  
  46.             iSumCashouts = CType(TransactionTableAdapter.scalarCashouts(lblCustomerID.Text), Integer)
  47.  
  48.             iBiggestWin = CType(TransactionTableAdapter.scalarBiggestwin(lblCustomerID.Text), Integer)
  49.             iBiggestLoss = CType(TransactionTableAdapter.scalarBiggestloss(lblCustomerID.Text), Integer)
  50.  
  51.             lblBiggestWinRes.Text = iBiggestWin.ToString("c")
  52.             lblBiggestLossRes.Text = iBiggestLoss.ToString("c")
  53.  
  54.  
  55.             ' Displays i formatted as currency for the CurrentCulture.
  56.             ' This will override any user settings and display the euro symbol.
  57.  
  58.             lblTotalRes.Text = (iSumCashouts - iSumBuyins).ToString("c")
  59.             ' FormatCurrency(iCashouts, , , TriState.True, )
  60.             Me.TransactionBindingSource.Position = Me.cboCustomerName.SelectedIndex
  61.         Catch ex As System.Exception
  62.             System.Windows.Forms.MessageBox.Show(ex.Message)
  63.         End Try
  64.     End Sub
Mar 7 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: martijn | last post by:
H! I have a big bsddb database created with python and that works fast. I know that I can use the python_apache module to show the data results online. //--- python_apache module <form...
1
by: popsovy | last post by:
I am new to the discussion groups and to the .NET world, so this is probably a very basic question.. Is there any quick way in .NET to auto-generate data forms from typed datasets or SQL queries?...
5
by: Patrick.O.Ige | last post by:
Whats the best way to pass Data with hidden fields in asp.net. I want to capture a LOGON_USER(from an intranet using Windows Authentication)and then send the data to a table in the Database. Any...
1
by: John Dalberg | last post by:
When I change the data source for a report say like from SQL to a stored procedure or if the table fields have changed, all the bound fields on the report vanish. It's time consuming to recreate...
0
by: bienwell | last post by:
Hi all, I have a data entry form in ASP.NET (Web development) which has some fields (field1,..., fieldN) , button ADD THIS RECORD, and button CANCEL. In button ADD THIS RECORD, I have VB.NET...
4
by: hhak | last post by:
Hi all, Im pretty new to C#, im trying to assign a combobox selected value to a int variable. int number; combobox has items added (1,2,3,4,...9) when i select a number from the combobox i...
2
tuxalot
by: tuxalot | last post by:
Simple question I'm sure. I have a combobox listing various company names. Below the combobox there are address, city and state boxes. When a person selects a company, can I have the address city...
3
by: FKlusmann | last post by:
I have inherited a big, messy table with duplicated data and empty fields consisting of Names (business, client, supplier, etc.), Addresses ( physical, mailing, shipping, billing), Orders ( Date,...
4
by: chinni1 | last post by:
I Have 2 comboboxes in my form.The first combobox1 shoud be fill with the mainproduts which is cmng from database.By selecting The mainproduct the related sub product shoud dispaly in second...
1
by: BarbieJo | last post by:
Using Access 2007 I want all the bound fields in my form to be locked until a command button is clicked. I have already tried locking the form through the OnLoad property using the following code:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.