473,387 Members | 1,455 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,387 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 1354

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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.