C# :: Find And Select Multiple Items In ListBox?

Apr 18, 2014

I have a listbox that retrieves a bunch of values. I'm able to selectAll, Select None and Select Individual items. I'm not able to search the ListBox and select based on String value.

I have tried creating a for and if loop, but it will only select a single item (first item) in my ListBox.

private void btnSelectCAD_Click(object sender, EventArgs e) {
// Find CAD Line Patterns that Begin with IMPORT:
string mySearchString = "IMPORT";
// Search Listbox starting from index -1:
int index = lstLinePatterns.FindString(mySearchString, -1);

[code]......

View 5 Replies


ADVERTISEMENT

C# :: Removing Items From ListBox

Mar 5, 2014

I'm working on creating a windows form with a listbox, textbox, and 2 buttons (add,remove). I need a way of removing every string matching the contents of the textbox from the listbox. Here's what I have:

for (int i=0;i<listBox1.Items.Count;i++)
{
//...
listBox1.RemoveAt(i--)
}

Seems to work, but I need a way to show a error message once the user clicks 'remove' and no items in the listbox match.

View 6 Replies View Related

C# :: How To Size ListBox Height To Items

Jul 24, 2014

Is there a way to set the height of a listBox to show all of the items without having to kick in the vert scrollbars? I've searched on this question but can't find how to do this.

I want to kind of auto-size my listBox height to accommodate my items (within reason and perhaps set a max height which would kick in the vert scroll bars.

View 9 Replies View Related

C Sharp :: How To Output Items In A Listbox

Mar 31, 2013

What codes in c# will output items in a list box?

View 2 Replies View Related

C++ :: Saving Listbox Items Into Text File

Jan 17, 2013

The process cannot access the file because it is being used by another process.

How can i edit CStdioFile to let me open the file while the program is running.

View 2 Replies View Related

C++ :: Using A Textbox And Other Items Between Multiple Forms

Oct 31, 2013

I am writing a program in Visual C++ 10 with 2 forms.

In the first form I have a textbox and a button. The button opens the second form.

In the second form, I have a button that changes the text in the textbox in form1 to an item from a listbox in form2.

Here is my problem. When I do the code for the button in form2 to change the textbox in form1 I get the errors:

error C2065: 'textBox1' : undeclared identifier
error C2227: left of '->Text' must point to class/struct/union/generic type

I thought maybe I should just include the "Form1.h" file but I can't do that because I already included "Form2.h" in form1 in order to be able to open the second form. If I try to include form1 in form2, it says that the code to open form2 is an error now.

My question is, how can I access identifiers such as "textbox1" from other forms and other files when I already used the first form to open the second form? I also want to know how to do this for all identifiers between all files.

how to print the selecteditem from a listbox into a textbox because that doesn't work by just setting them equal either.

Here is my code:

#pragma once
#include "Form2.h"
namespace Test1 {
using namespace System;

[Code].....

View 11 Replies View Related

C/C++ :: TCP Server / Multiple Client With Select Process And Forking

Sep 12, 2014

I have created a Server that can handle multiple users with the select function. The server seems to be operating just fine on every new request of a client even on the case of termination connection. The problem appears on the client side. I am applying forking process to be able to hear and write at the same time while the user is typing a message to the rest of the clients. By doing so I discovered that when the client is initialized it send a blank message to the server. The server then send this blank message to all the clients. I have discovered a "trick" not to display the message on the client side but I really would like to know if there is an alternative solution instead of my solution. I mean why it dose not wait for the client to first start typing a message before to send it.

The communication that will apply on each new connection is:

Client Server
Connect() −− >
< −− Hello version
NICK nick −− >
< −− OK/ERROR text
MSG text −− >
< −− MSG nick text/ERROR text

Sample of the Server.c code:

#include <stdio.h> /* stderr, stdout */
#include <errno.h> /* errno.h - system error numbers */
#include <stdlib.h> /* memory allocation, process control etc. */

[code].....

View 6 Replies View Related

C Sharp :: How To Select Multiple Columns In A Grid View

Nov 8, 2014

I am working on a windows application that is for make a time schedule for all staff. i am using two gridview one for all staff names from employee table , and second is for time schedule, time schedule DGV is like 6to7 , 7 to8...12to1,... 5to6 columns . when user will select like 7to8 , 8to9,9to10, columns with holding ctrl key , thn i have to assign some work beteen these time for 3 hours. So i have to get multiple columns from Gridview.

View 1 Replies View Related

C# :: Hotel Management App - Selecting Multiple Items

Jan 27, 2014

I'm writing a Hotel magmt app. I'm having difficulty on how to implement a hotel attendant selecting/secure multiple rooms(with nos) for a Customer using combobox or listbox or something. How my interface will look like and techniques.

View 1 Replies View Related

Visual C++ :: Finding Items (strings) In Multiple Lists

Mar 12, 2013

Im working on a script compiler and i need to handle different types of data. Actually different categories of items.

Let's say i have two categories: cat's and bird's. They are different and stored in different lists. And let's say there is a simple command: GIVE_FOOD_TO(animal_type, food_type) Animal type here can be either from birds category or cat's category.

And also let's say user gives command: GIVE_FOOD_TO(cat1, fish)
and also for example: GIVE_FOOD_TO(bird1, birdfood)

Variable names could be anything, but im storing each variable name in std::map so later i can figure out with what animal current command is used.

When im parsing the script then i must know if user supplied either cat or bird. If i just would have cat's or bird's category then i would have only 2 lists and not a big problem to loop through either cats list or birds list and find out in what list the "cat1" is or in what particular list the "bird1" is. It would be in one or another.

But i have a lot of categories and looping through all of these lists (or std::maps) is slow and doesn't seem like a good. Just to find out in what list it's stored. I can't rely on variable names, they could be anything.

Big picture atm:

1) I have one BIG box which stores all of the categories

2) When i need to find out to which category the variable (animal_type) point's to i must get it quickly, dunno, std::map in std::map or something?

What i need basically is: I have different lists (each one is just a category for either birds or cats in this example) And when i have variable name, i must find out quickly in what particular category this item is stored. So i can work with it.

View 4 Replies View Related

Visual C++ :: How To Use CListCtrl For Show Multiple DialogBoxs Like Items In Icon View

Jan 15, 2014

i can write a mfc program to make a Thumbnail view with image but can not this when change image with CDialogBox.

Thumbnail view with image(chart) like this:

for (int i=0;i<10;i++) {
CChartContainer *cc = new CChartContainer();
if(cc->m_frmWin->Create(_T(""),
WS_CHILD|WS_VISIBLE|SS_BITMAP, rc,
this,idDyn)) {
}
}

how can i write mfc program to make a Thumbnail view of CDialogBoxs?

do i can use CListCtrl for show multiple DialogBoxs?

View 13 Replies View Related

C# :: Moving Listbox Selection To New Listbox In New Form?

Sep 11, 2014

Okay so i have everything right accept transfering the selectedindex from listbox in form1 to listbox in form2. I am using the below string item to hold the selected line of the list box, with the intent of recalling and then adding it into the form2 listbox. I get a not implemented error and i can't figure out why. I know the information is moving with the variable item, it just doesn't get printed out to the new listbox.

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string item = listBox1.SelectedItem.ToString();
Form2 form2 = new Form2();
form2.Show(item.ToString());

[Code]....

View 13 Replies View Related

C++ :: Find Multiple Modes In Map?

Feb 14, 2015

I am struggling with a project right now and I was wondering if there was a quick way to find multiple modes in a map. So far I have a function that returns a vector of one or many modes depending on the map. I can't seem to wrap my head around how to test it->second against other seconds to find the one that occurs most often.

vector<double> mode(vector<double>& input) {
map<double, double> tester;
vector<double> mode;

[Code] ....

View 2 Replies View Related

Visual C++ :: Sum Multiple Group To Find The Max

Dec 17, 2013

How to sum groups in C++? I have a class with 2 attributes (Group and Price). I need to find the group with the highest amount. I can find the max when it comes to finding a set of individual numbers but not when a group is required. For Ex:

Group A64
Group A48
Group A18
Group B49
Group B36
Group C64
Group C75
Group C87
Group C72

The group with the highest amount is GROUP C

View 14 Replies View Related

C++ :: How To Select A File

Dec 13, 2014

I am asking if there is a way to select a file

View 8 Replies View Related

C++ :: How To Add A Select Option

May 27, 2013

I just started on a project on c++ and I was wondering if it is possible to add a select option (where the c++ program requires the user to select an option) . I couldn't find this anywhere.

View 3 Replies View Related

C# :: Using Array In Listbox?

Jun 2, 2014

My main form I have the following code

[ImportingConstructor]
public MainForm([ImportMany] IEnumerable<AudioPlugin> content)
{

[Code].....

However, when I add to the listbox as shown above in my main form code the results all show on the same line. My understanding was that they should all be treated as separate because of foreach loop but apparently that is incorrect. I have seen mixed things online some showing that its required to use AddRange instead of Add, however, after literally hours of trying to make this work I am still coming up with nothing. I can't seem to get any code to work using the AddRange or am I finding any way to output each results on a separate line.

View 7 Replies View Related

C++ :: Win32 Tab Select Notification?

Dec 18, 2012

I understand including the comctrl32 lib and header. I know to init common controls. I can create a tab window and add tabs to it.

I just can't seem to grasp of how to tell when a specific tab has been selected. I just need to know what to look for with winproc.

View 2 Replies View Related

C++ :: Listbox SendMessage Not Working

Jun 25, 2013

I have a problem with SendMessage. Anything I send doesn't show up but instead empty lines appear. What is wrong with my code?

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
TCHAR greeting[] = _T("Hello, World!");
wchar_t listBoxStr[15];

[code].....

View 7 Replies View Related

C# :: Invert ListBox Selection?

Apr 18, 2014

I have my ListBox working and I'm able to select the items I want to keep. I'm trying to now get the Invert of the current selection for the items to delete.

I tried using:

if (lstLinePatterns == null) return;
for (int i = 0; i < lstLinePatterns.Items.Count; i++)
lstLinePatterns.Items[i].Selected = !lstLinePatterns.Items[i].Selected;

But
.Selected
is giving me an object error.

Is there an easy way to just inverse current selection?

Current Code:

private void btnSelectNonRvt_Click(object sender, EventArgs e)
{
// Unselects any Items to Prevent Infinite Loop
lstLinePatterns.SelectedIndex = -1;

[Code]....

View 3 Replies View Related

C# :: Clear A Listbox From A Class?

Jun 5, 2014

I need to clear a listbox from a class other than the form where it exists. Why this isn't working? I'm getting no error messages when I compile and I am seeing the Console.WriteLine text I also added in the same function. I can call this function from within my form and it behaves as expected. I tried setting the listbox to public despite the fact I wasn't getting protection level errors but that made no difference.

Just to clarify what I'm doing here... I have a form that includes a panel of user controls from another class. So there is a listbox on OtherClass and the listbox is in MyForm. Heres my code:

MyForm

public void ClearListBox() {
Console.WriteLine("echo");
listBox.Items.Clear();
} OtherClass
private void listBox_SelectedIndexChanged(object sender, EventArgs e) {
MyForm mf = new MyForm();
mf.ClearListBox();
}

View 9 Replies View Related

C# :: Two Checked Listbox - One Interacts With Other

Aug 31, 2014

I am working on a Windows From application on Visual Studio 2010 where i need to use two checkedlistbox that interacts one with the other one. Let say that the first checkedlistbox is for world regions (i.e.):

Asia
Africa
Europe
South America

And let say that the second checkedlistbox is for Countries (i.e.):

Spain
Italy
Romania
Monaco

(all of this belongs to Europe region)

What we need to do is that when the user check on any world region it automatically checks all the countries on that region in the second checkbox, and vice versa if the users check any country on the second checkedlistbox it automatically seconds the region on the first one.

I know that is possible in Java and we know how to do it, but i don't know if C# supports this and how to do it. I was looking on the class information in the microsoft website: [URL] .... but not a concrete example on how to do it.

View 5 Replies View Related

C# :: Listbox Loop - Getting Value Of Both Cards

Apr 3, 2015

I have a lstYourHand that has two cards in it, I loop through the listbox to get the values of both cards. I take the string value of the listbox item (strCardVal) and use a switch to give it an integer value (intCardVal). For some reason, when I run the code, the message Box at the end gives me the value 0 as a result, it does not register me giving it a value in the switch statement. My code is below:

Int32 intCardVal = 0;
String strCardVal;
Int32 intLoopCounter1;
for (intLoopCounter1 = 0; intLoopCounter1 == 1; intLoopCounter1++) {
strCardVal = lstYourHand.SelectedItem.ToString();

[Code] .....

View 3 Replies View Related

C# :: Cannot Set Font Size For A Listbox

Jun 24, 2014

I was working with a richTextBox on setting its font, color and size. I found examples and got that to work. It seems like a kludge to me just to get the size set.

So, now I need to do the same for a listBox. I got the font and color set but cannot get the font size set.

The error I am getting is on line 6 below: listBoxTopLevelChecklist.Font.Size = fontDialog.Font.Size;

VS 2013 Express tells me this property (font.size) is read-only. That was the same error I got on the richTextBox until I found way using the .SelectionFont structure, but the listBox doesn't support that. So, I'm stuck.

Line 8 on is working finr for the richEditBox.

DialogResult result = fontDialog.ShowDialog();
if (result == DialogResult.OK) {
listBoxTopLevelChecklist.Font = fontDialog.Font;
listBoxTopLevelChecklist.ForeColor = fontDialog.Color;
listBoxTopLevelChecklist.Font.Size = fontDialog.Font.Size;

[Code] .....

View 2 Replies View Related

C# :: Change Listbox Color?

Dec 22, 2014

I've changed the listbox foreground color to default application background color so I get: [URL] which is fine but when I select any element I get white background/foreground(or whatever it is): [URL]

How can I change this so I will have the same default color in the second case?

It is a windows store app

Xaml code(listbox is at the end):

<Page
x:Name="pageRoot"
x:Class="ExchangeRate2.MainPage"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"

[Code]....

View 1 Replies View Related

C# :: ListBox Values And Arrays?

Sep 18, 2014

I'm making a simple airline reservation. I have two list boxes one has the section (A, B, C, etc) and the other rows (1, 2, 3, etc). I used two different arrays to put the values into the list box via form unload. The problem I can't seem to figure out is how can I update these seats and inform the user if a seat is taken or not. Lets say a customer takes A-1 (only seat taken). If I try to add someone else there it will inform me that seat is taken and to select another one. If all the seats are taken it'll tell me to put customer into the waiting list.

Also one more thing is that each row has 3 seats, so A-1, A-2, A-3 for example. If say A-1, A-2 are taken when I push a button show remain seats it should show A-3 only. I have a lot od struggle using arrays.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved