I'm having great difficulty trying to find how to simply get the text of one specific item in a ComboBox.
I have cmbSelectedHinge as a dropdownlist style. All I need is to know what the text is in position 0. I would have thought simply:
MsgBox(cmbSelectHinge.Items.IndexOf(0))
but no. It returns "-1" even though there is a line of text in it. It seems this question has never before been asked on the internet, and there's no useful information on MSDN.
Any help, please
I realize this is an old post but saw this while searching for something else. Thought i'd thorw in an answer in case anyone else comes across it and needs it
MsgBox(cmbSelectHinge.Items(0).ToString)
Would give you the value in the very first position of the combobox
MsgBox(cmbSelectHinge.Items(1).ToString)
Would give you the value in the 2nd position
Related
I have looked but have not been able to find another posted question that matches my scenario.
I am replicating a report from an old DB and rebuilding it using a new DB, so I'm simply copying the old report elements and pasting them into a new report template and modifying as needed. I've gotten to one part where the error I'm getting is as follows:
The Color expression for the text box ‘Textbox94’ refers to the field
‘Gallon_Qty’. Report item expressions can only refer to fields within
the current dataset scope or, if inside an aggregate, the specified
dataset scope. Letters in the names of fields must use the correct
case.
I have looked everywhere I could possibly think to look to see where this issue is hiding, but cannot find where this textbox is 'referring' to anything. Since it appears to be specific to this textbox, I presume it is specific to the text box properties of that text box, but it seems I'm mistaken. For added clarity, what I have checked includes every menu option within the text box properties (General, Number, Alignment, Font, Border, etc.) and every fx (function) button to ensure nothing was hiding (that's gotten me before). I have compared with another report element that works similarly and cannot find where the problem is. Any tips on where else I might check to uncover the root of this issue? Happy to provide screenshots if it will help, just let me know.
Side note: I can't thank you guys enough for all the help I've gotten on here!
I discovered where the issue was.
Text Box Properties>Font>Color>fx box
This is where the value was hiding. Hope this helps someone else.
I want to do a simple thing but I don't have any idea. I made a button in GUI status it has a functon key and it works. Now the real thing. I want that for every checkbox I mark, when I press the button to call a new screen to show me only the entries that were checked.
The checkbox is added in the itable, but I think it doesn't matter that much. How can I tell the button which checkboxes on screen where checked?
The answer is pretty much what Bernard said, though it is lacking some detail.
You will need to know how many lines you wrote, this is stored in SY-LINNO, note that you need to also take into account how many pages you outputted which is stored in SY-PAGNO and how many lines are on a page which is stored in SY-LINCT.
You could get that info, which is probably a better approach, with 'DESCRIBE LIST'.
Then for each line with the command 'READ LINE' you can find the value of the checkbox.
READ LINE line OF PAGE page [result].
From there things should be a piece of cake.
For the checked records the checkbox field is 'X', while for the unchecked records the checkbox field is space (' '). So you need to loop over the records on the screen, then only display the ones where the checkbox is equal 'X'.
Besides all the answers you already got, you don't want to dig into interactive list programming any deeper (unless you have to do this for a programming exercise). Take a look at the ALV Object Model Documentation and the SALV_DEMO_* example programs.
I've not been doing much WinForms programming for the last few years, so I'm a bit rusty. Right now I'm having trouble with something pretty simple. I have one table of data that includes two foreign keys to two other tables. What I want to do is simply display a list box that shows a name field from the table and several text boxes below, which display the rest of the data in the row corresponding to what is selected in the listbox.
I tried simply setting the datasource on the listbox and then binding the detail textboxes to columns in the same datasource (using bindingsource), and that seemed to work fine. However, when setting the comboboxes up for the two foreign key columns, they did not reliably change to display the correct value as the user selected different items in the listbox. Additionally, when I made any changes in the detail textboxes, the HasChanges method on the dataset still returned false.
What do I need to do to get this to work correctly? Is there a good example out there somewhere? Google just seems to return a ton of results showing how to populate a simple listbox.
I saw this had been up for a few days so I'll provide what help I can...
I'm a bit rusty in that area as well. However, the place I always go back to for a refresher is the Forms over Data Video Series by Beth Massi. They are short, sweet and to the point. My guess is that you'll find what you need within the first few videos.
Disclaimer: The videos were done using VS2005. The fundamentals are solid though. While one or two minor things may have changed, WinForms databinding is pretty much the same as it has been for a while.
HTH and good luck!
Im looking forward to writing a combobox with history. Much like address bar, only simpler(no searching, use history only). Since this is quite common, i think maybe there is a library or anything on it. I dont want to write the system from scratch(which ive been doing anyway until i realize its too much work for simple unrequired feature).
So, my question is, how can i have a combobox that can save information that user entered, manage the information that the user entered(delete, rank up/down etc).
Thanks.
i think one solution could be to define an object with hold the entered information and other information like delete command, rank value. then put this object in a observablecollection, use it as the combobox itemsource and whenever a user put something in your comboxbox update your collection in the way you want.
Is it possible to always keep selected item in the middle of a listbox? If the user selects an item, I want to scroll so that the newly selected item is in the middle.
I guess it want be possible for the 'edge cases' (the first and last few items), but that's ok.
David Anson posted some articles on his blog that might help you here: Part 1 and Part 2. He gives an extension method that centers an item in an List Box. You might be able to build on that.
It is possible with couple of lines of custom code. Here's a discussion of a sample implementation. You might need to tweak it a bit to account for even number of items, insted of only odd number, but the general idea is the same.