473,320 Members | 1,961 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 Integer

Hi

I have connected my program to an access database file, and when I select the numbers in the combobox (1, 2, 3 etc.) I want to automatically fill the other textboxes in the form .. it works if it's a string .. for example if i select a string (e.g. name) in the combobox it automatically fills the other textboxes, but it doesn't work if it's an integer.

I know I must convert to int, but I don't know how because i have a query:

Expand|Select|Wrap|Line Numbers
  1. private void iD_FurnizorComboBox_SelectedIndexChanged_1(object sender, EventArgs e)
  2.         {
  3.             try
  4.             {
  5.                 connection.Open();
  6.                 OleDbCommand command = new OleDbCommand();
  7.                 command.Connection = connection;
  8.                 string query;
  9.                 query = "select * from Furnizori where id_furnizor = '" + iD_FurnizorComboBox.Text + "'";
  10.                 int query_test = int.Parse(query);
  11.                 command.CommandText = query;
  12.                 OleDbDataReader reader = command.ExecuteReader();
  13.                 while (reader.Read())
  14.                 {
  15.                     numeTextBox.Text = reader["nume"].ToString();
  16.                     adresaTextBox.Text = reader["adresa"].ToString();
  17.                     localitateTextBox.Text = reader["localitate"].ToString();
  18.                     judetTextBox.Text = reader["judet"].ToString();
  19.                 }
  20.                 connection.Close();
  21.             }
  22.             catch (Exception ex)
  23.             {
  24.                 throw ex;
  25.             }
  26.             finally
  27.             {
  28.                 connection.Close();
  29.             }
  30.         }
  31.  
I don't know where to parse the string to int.. thank you!!
May 20 '15 #1
0 1348

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

Similar topics

13
by: Mr. B | last post by:
Here's the situation... You've a combobox with Items already added. Say they look like this (or even lines of text): 10-00-232 10-00-256 10-01-006 10-01-213 10-02-200
2
by: Don | last post by:
I've looked high and low for some code that will allow me to have a combobox with a flat borderstyle. I found a few examples, but nothing that was really usable for me. I had the following...
5
by: Keith G | last post by:
I am using Visual Studio 2003. In the standard combobox control it would appear that only 1 column of data can be displayed in the list (as stipulated in the DisplayMember property). In VBA it was...
7
by: samoore33 | last post by:
I am trying to dynamically add items to a listbox or combobox. The items add to either, but when I look through those items, there is nothing there. If I choose an item, it shows up. Not sure...
5
by: active | last post by:
I tried to use a datasource with a combobox and it didn't work completely so I build a small test that was much more straight forward then the app. The test was to see if the combobox dropdown...
10
by: Doug Bell | last post by:
Hi I am still having problems with Tabbing through a DataGrid with a DataGridComboBox Column. I need to allow the User to Type the value into the ComboBox so consequently its ComboBoxStyle is...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
5
by: Kevinp | last post by:
I've spent the last four hours Google searching for a way to disable items in a Combobox. I found one example in C++ which I can't get to work and another in C# that I couldn't get to work either....
1
by: Man4ish | last post by:
Hi, How Eventlistner can be used with rendred combo box. I got one example of combobox in table as follows . /* * Copyright (c) 1995 - 2008 Sun Microsystems, Inc. All rights reserved. * ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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

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.