C/C++ :: Get The Position Of A Selected Item In A ListBox
Jul 21, 2014I've a winapi listbox with a bunch of entries, I'd like that when the user click on an entry, the entry number will be saved on an integer variable.
View 3 RepliesI've a winapi listbox with a bunch of entries, I'd like that when the user click on an entry, the entry number will be saved on an integer variable.
View 3 RepliesI want to set the rootpath of an executable application. This rootpath should be the same as the path of an item that I select from a ListBox. The code for selecting the item is as follows.
namespace Menu {
public partial class Form1 : Form {
private Button button;
private ListBox listBox1;
private string selecteditem;
[Code] ....
Now what I want is: Whatever I get the output as in the :
Console.Writeline(path + selecteditem),
I would want to set this as a rootpath for an application so as to do rest of the measurements or steps only in that path/folder. Is it possible to do something like this?
I have a C# WPF program that takes a SQL query and populates a column from an Oracle database into a listbox on the form. I would like to be able to compare all items populated in the listbox, and run a SQL query for each item, populating those values into a different listbox.
So far, I have this code:
string sql2 = "select unique apps.fnd_application_all_view.application_name, fnd_responsibility_vl.responsibility_name, fnd_form_functions_tl.user_function_name, fnd_form_functions.function_name, fnd_form_functions_tl.description, fnd_form_functions.type FROM fnd_compiled_menu_functions, fnd_form_functions, fnd_form_functions_tl, fnd_responsibility, fnd responsibility_vl, apps.fnd_application_all_view WHERE
[code]....
I would like to be able to basically take the "Responsibility_Name" value from the first listbox (lstResponsibilities), which is already populated, and use those values to in the "sql2" query to find the "Function_Name" and populate "Function_Name" in the second listbox (lstFunctions).
how to create a context menu but none of them discuss how to actually fetch the selected menu item?
if (e.Button == MouseButtons.Right)
{
ContextMenu m = new ContextMenu();
m.MenuItems.Add(new MenuItem("Font Size 8"));
m.MenuItems.Add(new MenuItem("Font Size 9"));
m.MenuItems.Add(new MenuItem("Font Size 10"));
m.Show(listBoxChecklist, new Point(e.X, e.Y));
//tempString = m.?????
}
I'm using listView to show content (selected item) in ComboBox, TextBox, Labels..
I was using
DropDownStyle = DropDown
and actually i use DropDownStyle = DropDownList.
With this change,
comboB.Text = Name;
stopped working correctly (onload), only work after first click any item. Why?
I tried too
private void comboB_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
but with copy/paste with mouse i can add text in ComboBox.
PS: My objective is combobox no editable.
How do I get the path for a selected item in a list control?
View 5 Replies View RelatedI have a list with 2 items in it. When I double click on item 1, I want to open Window1.xaml, when I double click on item 2, I want to open Window2.xaml...
The code below works for popping up a message box, or window for that matter. But I really need to get the Window1 and Window2 based on the clicking of the correct selected item in the list.
Here is some code:
<ListView d:DataContext="{d:DesignData }" Name="PharmacyLv" IsSynchronizedWithCurrentItem="True" l:Sortbehavior.CanUserSortColumns="true" >
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<EventSetter Event="MouseDoubleClick" Handler="ListViewItem_PharmDoubleClick" />
</Style>
</ListView.ItemContainerStyle>
[code].....
How to display the item in listbox,which are selected from three combobox.
View 1 Replies View RelatedI used VB6 before to output file.
I set my output to file to tab(20) or tab(45) respectively.
In C++, how do I do this?
I want to retrieve the records selected between from_dt and to_dt and also the records of the selected date should be retrieved...
SELECT ChallanDtl.chalID, ChallanDtl.chalTo,
ChallanDtl.chalNo, ChallanDtl.chalDDate,
ChallanDtl.chalYourNo, ChallanDtl.chalPO_NO,
ChallanDtl.chalPO_Date,
ChallanSubDtl.chalsubdescription,
[Code] ...
I am not getting all the records.... when i select the same date in both datetimepicker no record is displayed... i also want the record of the selected dates from both datetime picker..
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]....
What I have to do is write a small program in C++ to parse the symbols that are used on 5 different lines of text in each position until position 30 is reached on each line. The goal of the parsing program is to interpret the symbols (characters), if there are any per each position, on the 5 lines of text in order to output the actual data that the group of symbols represents.
My question for is this: Is there anything special from a C++ environment that should go in to something like this outside of using standard stuff like the math associated with the search algorithm that has to happen here? The symbols are located in a file, so I know I have to include "iostream" and a few other headers. But outside of header inclusions and the code necessary to iterate and streamline the search and interpretation process, am I missing anything special that I couldn't otherwise find through simple google searches?
I have two menu items. When item 1 is disabled, I want item 2 to be disabled as well. In the OnUpdate handler of menu item 1, I have tried to use "t_pMenu = pCmdUI->m_pMenu;", "t_pMenu = pCmdUI->m_pSubMenu;" and "t_pMenu = pCmdUI->m_pParentMenu;" but I always get NULL t_pMenu. How can I achieve this purpose?
Code:
void CDummyView::OnUpdateMenuItem1(CCmdUI* pCmdUI)
{
if(m_bShowMenuItem1) {
pCmdUI->Enable(TRUE);
[Code]....
I have a text file in which i need to read only selected letters and substitute them with integers to calculate.
Eg:-
In the text file
f2,h1
Here i need to read only the the letters f & h and substitute them with some integer and add them up.
I have a secnario where I have few tab controls one ineide the other, where my real tab pages containing the data are 4 level deep. This entire structure is dynamically built from a data base.
Now I have a tick event, on whice I want to update the data in the currently selected tabpage.
How can I find it, recall that I have many tab controls, each has a tabpage with another tab control an so forth...
Two ideas I had in mind, I though I caould generate a list of all my data TabPages and itterate it, but I failed to find an indicator of the selected tab.
Another idea was to track the currently selected tabpage via an event, but I feared that I might miss somehow the track and my update the wrong tab page.
Last idea was really unelegant - Look at the main control, get the selected tab page, find the tab control on that page via searching its controls, than find this control selected page, and do the same until I reach the 4th level.
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.
I want to create a GUI using C, for displaying time when a time zone is selected.
I absolutely don't know how to write a program for that. How to get the time of a zone displayed when the zone name is given as input.
This is part of the program, What should i do if i want to total the number of times a shape was selected at the end?
#include<iostream>
#include<string>
#include<iomanip>
[Code]....
I'm trying to find an event for the combobox when its selected value changes , but I can't seem to find the right one since I've tried several events in the dataGridView that are just triggering at the wrong moments. I need to remove the selected item from that combobox so that it doesn't get selected again at the second combobox which usually have the same items .
View 5 Replies View RelatedI am developing a project that generates questions from a database, the questions are generated with multiple choice answers. On this form I have got a textbox that reds the question from the database and 4 radio buttons that reads the possible answers from the database. The radio buttons text names are updated with records from a database table each time the "next button" is clicked.
What I want this program to do is that when the user selects one of the radio buttons, I want the system to check if the selected radio button textname equals the right answer in the database table. for example in the table there are 5 columns namely: option1, option2, option3, option4 and rightAnswer. So whenever a user selects a radio button, I would like the system to check if the selected radio button's textname equals the record in the "RightAnswer" column and if so I would a messagebox to show "correct" and if not the messgaebox to show "wrong"
This is the the way I am updating the radio button text names from the database This method is called when the form is loaded
void LoadingPossibleAnswers() {
Query = "SELECT * FROM AnswersTbl";
theReader = conn.ExecuteStatement(Query);
while (theReader.Read()) {
radioButton1.Text = theReader["Option1"].ToString();
[code]....
This method is called when the button is clicked
void CorrectAnswer( RadioButton rdb) {
string correct = rdb.Text;
Query = "SELECT * FROM FROM AnswersTbl;"
theReader = conn.ExecuteStatement(Query);
while (theReader.Read())
[code]....
When ever I run my code above, else condition executes even if the correct radio button is selected.
how to get source path of selected file.
for example :
selected image in E:/
E:ewfolderillustration.jpg
application - asp.net(C#)
I want to select text entered in a popup and save it. I have a form that contains a text area and a button
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Height="103px" Width="262px"></asp:TextBox>
<br />
<br />
<asp:button runat="server" text="Add" onclick="Unnamed1_Click" />
when we click on a line in text area I want to open a popup having all text from that line. I should be able to select some of its text then if I click on save button of popup then only selected text should be saved and displayed in original text area of form. I want to use this for multiple sentences of text area.
Add button will add new line.
i have 10 column in my datagridview. i want to get whole value from row(which row i'll select). i have this code but it's shows only one cell value,
richtextbox.Text = dataGridView1.CurrentCell.Value.ToString();
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].....
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]....
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();
}