473,796 Members | 2,911 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ComboBox and ListView Combination

8 New Member
Actually, i m working on Windows Application where i have to use the ComboBox and listview in a way , as first we will click the comboBox and then as you click , ListView appear and when we select something , that will be selected at comboBox also and ListView will disappear, and comboBox item should get selected.
Here i m having a problem as comboBox gets empty when list View will apear
Focus and thatswhy selection become Error,

So plz help what should i do for this ,

ComboBox Click Event
]
Expand|Select|Wrap|Line Numbers
  1. private void cmbSta1So1_Click(object sender, EventArgs e)
  2.         {
  3.  
  4.             ListView lv = new ListView();
  5.  
  6.             if (((ComboBox)sender).Tag.ToString() == "Start")
  7.                 lv = (ListView)lvChannels;
  8.             //else
  9.             //    lv = (ListView)lstCoeff;
  10.  
  11.  
  12.             //lv.Tag = Aindex.ToString();
  13.             lv.Left = ((ComboBox)sender).Left;
  14.             lv.Top = ((ComboBox)sender).Top + ((ComboBox)sender).Height;
  15.             lv.Visible = true;
  16.             lv.Focus();
  17.             if (((ComboBox)sender).Text == "")
  18.                 lv.Items[0].Selected = true;
  19.             else
  20.             {
  21.                 lv.Items[lv.FindItemWithText(((ComboBox)sender).Text).Index].Selected = true;
  22.             }
  23.         }
  24.  
  25.  
ListView CLick event
Expand|Select|Wrap|Line Numbers
  1.    private void lvChannels_Click(object sender, EventArgs e)
  2.         {
  3.              getChannels(((ListView)sender));
  4.  
  5.         }
  6.  
  7.         private void getChannels(ListView lstV)
  8.         {
  9.              //int Aindex = Int16.Parse(lstV.Tag.ToString());
  10.             lstV.Visible = false;
  11.  
  12.             if (lstV.SelectedItems.Count > 0 && lstV.Name == "lvChannels")
  13.             {
  14.                 MessageBox.Show(cmbCondSta1So1.Items.Count.ToString() );  
  15.  
  16.                     //cmbCondSta1So1.SelectedIndex = lstV.SelectedItems[0].Index ;
  17.                     MessageBox.Show(cmbCondSta1So1.Items.Count.ToString());
  18.                     cmbCondSta1So1.Focus();
  19.  
  20.             }
  21.             lstV.Visible = false;
  22.  
  23.         }
Sep 11 '08 #1
0 1458

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

Similar topics

4
14181
by: Ben Coats | last post by:
Hey, I'm trying to find code for an Explorer-style Directory ComboBox. (You know, it display "Desktop", "My Computer", all drives, etc., but it has a treeview control inside the combobox so that you can navigate through the file system as well.) I've found some on the web, but all of them just have the drives and desktop directories and are static in that you cannot expand the directories. I normally build a treeview control to do it with,...
1
2590
by: nate axtell | last post by:
I need something that looks like a ListView but will allow SubItems of the ListView to be ComboBoxes, or allow the contents to be a ComboBox. So for each row in the ListView one of the columns would have a ComboBox that allows the user to make some selection for that row. Does anyone know if this is possible or if there is another object provided that would allow this kind of functionality? Thanks, Nate
1
5683
by: Mamatha | last post by:
Hi I have one application ,that diplays data from database into the listview control.While adding data to the listview i want to display an icon to the leftside of the first column's data.Here is my code, but icon is not apperead with that code. Source code
1
2523
by: Ken Yu | last post by:
Hi, How can create image in ListView and ComboBox ? tks a lot ! Ken
0
1246
by: reidarT | last post by:
I have found a good combobox with multiple fields The example shows filling the combobox from a listview, but I want to fill it with zip-code and cities from a database. The example is as follows: Dim dtLoading As New DataTable("UsStates") dtLoading.Columns.Add("Name", System.Type.GetType("System.String")) dtLoading.Columns.Add("Abbreviation", System.Type.GetType("System.String"))
0
1209
by: morfasie | last post by:
Hi, I ewas wondering, is it possible to add a combobox to the subitems of a listview or listbox? like: column1 | column 2| column 3 | ----------------------------------------------- dddddd | dddddd | combobox
0
3556
by: ER | last post by:
Hi Guys Started having a play with WPF and need some direction with a grid. I am trying to build a list of products in a grid view with combox boxes as column headers that allow filtering and sorting (similar to lists in excel). Pic attached: http://www.ozgrid.com/images/Pictures/Filterswitches&Dropdown.jpg As a bonus, I would like the the columns to be able to be re-ordered at run
1
11042
by: Shimon Sim | last post by:
I can't figure out how to bind ComboBox inside of ListView or ListBox. How do I set ComboBox.ItemsSource property? I don't see the way to do it in code and not in XAML. I have Collection that is bound to ListBox / ListView and string that should be bound to ComboBox. Thanks, Shimon.
3
17256
by: Simon van Beek | last post by:
Dear reader, What can be wrong in my ComboBox, the property "Auto Expand" is set to Yes, but by typing in the ComboBox it doesn't expand. Is this because the source of the ComboBox is a query.
0
9685
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
10467
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
10244
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...
1
10201
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6802
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
5454
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...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
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
3744
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.