I'm a novice in programming and I'm seeking advice on my program in visual basic (visual studio 2010).
I'll describe my aims of the program and how I've created a mock up.
My main interface will have several tabs. Within each tab, there will consist of a few textboxes for entering data and a few checkedlistboxes with a list of items in each of them.
What I'd like to do is to gather all the information inputted and/or clicked by a user of the program and to assimilate the information to a pre-formatted text box, that will give me the option to output it to a file. I'd like the pre-formatted textbox to gather the data from the different textboxes and checkedlistboxes from the various tabs. I can give an example (non-code) of what I mean:
Tab 1 of application:
textbox asking for name
textbox asking for date
checkedlistbox with items ("green", "blue", "red")
Tab 2 of application:
textbox asking for name of country
textbox asking for citizenship
checkedlistbox with items ("north", "south", "east", "west")
Tab 3 of application:
textbox that is "preformatted" to grab the data from the first two tabs so that I can save it to a textfile that would look like this
My name is Billy
Today's date is 31JAN2010.
I like: green blue red,
I come from United States of America.
I am American.
I am from the region of South
As of now, the method I'm using is largely inefficient. I'm just not knowledgable enough yet to do what I want do I've resorted to this strategy:
For checkedlistitems, I output the list of items to a textbox. I make this box invisible to the user. I then call this box in my tab 3, which has a button and text area. The button portion automatically codes the "preformatted" text and its a matter of referencing the invisible textbox which contains the item lists that were checked. One problem with this, or how I've programmed the checkedlist box, is that If I check something, and then uncheck it, it still appears in my tab 3 textbox.
For example, If I was a user using the 2nd tab and I clicked "South" but then unclick it and click "North", the textbox says
I am from the region of South North
I'm not sure which property or where in my code I need to alter so that it can remove items. I'm using a for loop to grab the items and don't have my code on hand.
In general, I'm just looking for strategies for programming something like this that will be efficient compared to what I have. Any suggestions / examples / code is well appreciated.
For your checkedlistbox, you can use the even SelectedIndexChanged that way when you change the selection, you won't have that problem:
example of how to use:
If you have a simple label for example :
Label1.Text = "I am from the region of " & checkedlistbox1.selecteditem.value
Btw in your case I don't think a for loop is necessary.
If you wish for information try w3schools or msdn.
Regards
Related
I have one ComboBox which is populated on load from populate.txt file. I'm using streamreader for this. So far it works. The ComboBox is properly populated with:
- one
- two
- three
I have one empty TextBox, and a button.
The thing that I'm trying to do is:
Select something from the ComboBox i.e. "one"
Write in the TextBox i.e "50"
Press the button, and to populate the DataGridView first row with:
"One"(cell0) "50"(cell1)
At this point, a new empty row should be automatically added below the filled one. I've searched and searched for hours to no avail. So I decided to make an account and ask the question :)
The reason I'm doing this is that, later on I'll export the filled DataGridView.
I could easily use labels for this, but that's not what I'm aiming for. I'm trying to "dive in" into the more complicated "stuff".
I hope that I explained well enough.
I have an msoControlComboBox item in an Outlook 2007 command bar. I am able to add items to the combo box dropdown, and if the user types something in the textbox that matches the beginning of any words in the dropdown, then the combobox suggests the rest of the word, inside the text box.
I would like to do a little better than that.
I would like to be able to detect keypress events, and add/remove items from the dropdown list based on the characters the user has entered so far.
I would also like to be able to dropdown the list programatically (right now the only to drop it down appears for the user to click on the dropdown arrow).
Is there a way to accomplish these two objectives (in c#).
There is no out of the box microsoft control that can do it.
You aren't the first person to want this however and I personally used a control found here and found it to be a good starting point for my needs. It's aimed at finding in email addresses but it can be adapted to other needs. It uses regexp searches to find matches
I'm trying to solve a formatting issue I'm having with Oracle Apex. Overall, this is a fantastic tool for whipping up proof-of-concept type applications, but whenever it comes to "prettying up" a page, it seems to be very difficult to work around.
I have a simple form-based page based on a table. However, I'd like to do a few simple things like group certain fields together on the form (phone info), perhaps throw an image in etc. I can't see any way to do either of these things inside a form. For example, here is an example page
and here are the small changes I want to make (photoshopped):
What the heck am I missing here? I can't seem to add anything except database fields inside the form to visually change things.
Any help appreciated.
It can be done - see this demo (I took the liberty of copying your icon, hope you don't mind). It looks like this:
How it was done
1) I uploaded the image into Apex. (Alternatively it can be hosted elsewhere).
2) I created a page item of type "Display Image" with attributes as follows:
Note the use of rowspan=3 in two places (circled in yellow), to make the picture and its (blank) label occupy 3 rows of the HTML table Apex uses for layout.
3) I created a page item of type "Stop and start table" and put it after the Mailing Address item. This prevents the phone icon taking up the same horizontal space as the name and mailing address, resulting in phone items being pushed too far to the right.
4) I set the "Begin on new line" property of the first phone item to "No" so that it appears to the right of the icon. The remaining phone items have "Yes" so that they appear below the first.
I have a list that the user can filter in several ways. two of which lend themselves to combo boxes and two that need to accept user input. For example, one textbox allows the user to type in any part of a list item's description, and the dialog will only present items whose description contains the text entered.
It is a dialog 'picker' type of window, so space is at a premium. I'd like for the text boxes not to require a traditional label. Instead, when the dialog is first invoked, the label (ie, "Description") is grayed out, centered, and in italics. Maybe a tool tip to further make it obvious to the user what it's for. When the user starts to type, the faux label disappears and the entered text is normal left aligned text.
Does wpf / silverlight have any native support for doing something like this? I guess it could be a combination of styles and eventing. I'd rather not invent any wheels that might be out there (I got the idea specifically from looking at Tortoise' "Show Log" window, but I've seen it before).
Does anyone have any sample code they can share to do this? Or a an alternative idea that also saves space and simplifies the layout?
Cheers,
Berryl
Kevin Moore's InfoTextBox, which is part of his Bag-O-Tricks is the kind of thing I was looking for, almost exactly. This is also the 'watermark' (great name - I would have found this sooner if I had known that) text box from another post.
THis is a followup to my previous question "Font-dependent control positioning." It's an attempt to solve the real problem behind that question, perhaps in ways different than the one I was asking about.
Example of the problem statement: I want a checkbox that says "Adjust prices by <X> <Y> after loading," where <X> is a number---adjustable with a NumericUpDown---and <Y> is either "percent" or "dollars," with the choices being made by a ComboBox. This will be on a single line.
The complication: I want to be able to change my fonts for all these controls (basically setting them to System.Drawing.Fonts.MessageBoxFont, which is Tahoma 8 pt on Windows XP/etc. and Segoe UI 9 pt on Vista), without messing up my layout, which with my current Position-property--setting paradigm does not work.
More generally, I'd like the controls to be dynamically laid out in a font-independent way, so that the <X> NumericUpDown fits snugly into the space between "by " and the <Y> ComboBox, and similarly the <X> ComboBox fits in with respect to the <X> CheckBox and the string " after loading" to its right.
The part everyone seems to miss: This is all nested within a CheckBox. So, ideally, clicking on the words "after loading" should check/uncheck the checkbox, and draw that little highlight rectangle around "Adjust prices by after loading." So just slapping an extra Label on the end doesn't work, because then it doesn't toggle the CheckBox; similarly, trying to band-aid things by hooking up such a Label's Click event won't produce the desired highlight-rectangle.
Solutions? At this point I'm thinking either:
Rethink the problem, somehow, maybe with an ugly solution like two separate lines of text: "Adjust found prices after loading" (CheckBox), "Adjustment amount:" (NumericUpDown and ComboBox). This is really bad because my options box is absolutely full of options of this type (i.e. the type in the example), so it would at least double in vertical size.
Some sort of custom control? SplittableCheckBox?
Some kind of magic with a TableLayout control? (Pretty sure this fails at "the part everyone seems to miss.)
Give up and either go back to MS Sans Serif, or use Tahoma uniformly, or package Segoe UI with my application, thus disrespecting the system default fonts.
(New, via edit) Switch to WPF, if someone can convince me that it supports this scenario exactly.
If you have several options that follow this layout, why not create a user control? The user control will contain the CheckBox, a NumericUpDown, a ComboBox and a label for the "after loading". You can override OnFontChanged to adjust the location of the controls based on the rendering of the text with the given font. Add an EventHandler to the Label to check/uncheck the CheckBox.
As for having the focus rectangle surround all of the controls, you should be able to give the user control focus when one of its inner controls is clicked.