473,671 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

In a combobox, how do I change the data type to an Integer?

3 New Member
I want to have a simple comboBox1 that displays a DropDownList consisting of the number 1 thru 12.

How do I get the comboBox1 data type to be an Int instead of a String??

Thanks in advance for help in this matter.
Mar 2 '10 #1
4 11198
kurtzky
26 New Member
you mean you want to get the value of the selected item?

Convert.ToInt32 (comboBox1.Sele ctedItem.ToStri ng());
Mar 2 '10 #2
KitCarson
3 New Member
I guess what I mean is that I want to use the 'selected item' as an integer. For some reason I cannot get it changed from a String. There has to be something elementary that I'm looking over.
Thanks......... ............... .
Mar 2 '10 #3
tlhintoq
3,525 Recognized Expert Specialist
You don't. Combobox items are strings.
But you can easily convert a string to an int.

Convert.ToInt(m yCombobox.Selec tedItem);
Mar 2 '10 #4
KitCarson
3 New Member
Thanks!!

I was looking at it the wrong way.
Mar 2 '10 #5

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

Similar topics

9
419
by: Scott Johnson | last post by:
Hi! I have 2 items that I need to show in a ComboBox in VB.NET (CF) called ExpenseCode and Expense Description. I only want to show the user the ExpenseDescription in the dropdown ComboBox but still keep the ExpenseCode in a "hidden" value field since there is so little room on a PocketPC screen. Is there a way to tie a hidden value to a ComboBox item that could hold that ExpenseCode? (Way) Back when I used eVB, I used to just use...
4
3348
by: Rob Kroese | last post by:
I've got a form with a datagrid that displays a list of items, along with several textboxes, comboboxes, etc., that display the details for the selected item. The columns in the datagrid and the "details" controls are both bound to fields in a dataview called dvItems. The dataview is a subset of a datatable called dtItems, which is simply a copy of all the data in a table called Items. The idea is to allow the user to edit an item in...
8
2067
by: Dennis D. | last post by:
Preface: I have viewed the combobox control video at Microsoft.at the movies. I want to simulate an HTML combobox as a windows application combobox with 5 to 10 selections in each box. In the HTML form: <option value="help.htm">More Info</option> Thing is: I want to put the URL description "More Info" into the combobox list, not the URL "help.htm."
4
8502
by: Joe Schmoe | last post by:
All I want to to be able to take a two-column DataReader (One column with the Item ID number, the other with Item Description text) and load it into a Windows Forms ComboBox (Set to DropDownList mode) so that I the dropdown shows the Item Descriptions, but returns the Item ID number when selected. Completely easy in ASP.NET, but I cannot figure out how to do the same in a Windows Forms app. Obviously the Windows Forms ComboBox is a lot more...
5
10287
by: Gil | last post by:
Is there a way to tell if a combbox is in dropdown mode. I tried and if statement combobox.dropdown = true but i get an error. dropwndown function doesnt store if its true or false what i am trying to do is make an autoscroll combobox. like you have on html textbox's, but this time you hit enter for a change to be made. i do this because i dont want to requery every time a single letter is inputed. it would be too slow. so i make them hit...
1
2091
by: fiaolle | last post by:
Hi The first set of source code is the class for a combobox in a grid, hopefully. In the second set of code we try to use the combobox class, but the grid is empty. I don't understand how this works. The first set of code I downloaded from internet and when i tried it, it worked fine. But when I changed the second part of the code it started to give me trouble. Before I changed the code they used Datacolumns,Datarows and Datatables and...
19
2196
by: active | last post by:
I'm using a ComboBox to display objects of a class I've defined, say CQQ. Works great except somehow I occasionally set an Item to a String object instead of an object of type CQQ. It looks like Text replaces an item or something like that. This results in a runtime error at which time I learn that the item that should be CQQ is a String.
10
2028
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 set to DropDown. This causes the Tabbing to work incorrectly. Even though I am consuming the Windows Message WM_KEYUP, it still Tabs through the ComboBox Column on to the next Column. I found if I do not give the keyboard focus ie remark out...
4
6662
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 common/standard .NET control accepting an Object as a parameter type? In Web Forms, there is a ListItem object that can be passed in to add/retrieve objects from a DropDownItems collection. I searched Google groups, and all the solutions I'm finding...
1
3537
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. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met:
0
8483
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8402
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8927
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8825
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8676
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.