I have a combo box with a list of mobile tariffs in and a service credit textbox (Not Visible) that the sales agent will fill in. What i need to know is, how do i make the service credit textbox visible IF the combobox contains the word "Resign"?
Thanks
Use the after update event of the form https://msdn.microsoft.com/en-us/library/office/ff822097.aspx then use the controls visible property https://msdn.microsoft.com/en-us/library/bb258163(v=office.12).aspx
Related
I am working on a small project in an Access database. I currently have a Y/N checkbox in a registration form that I want to link to a textbox in a report. For example, when I check the box in the registration form, I want it to automatically input "Y" in a textbox in the corresponding report. I have never written in VB. Any tips would be appreciated.
I have an application whereby I have the behaviour of 2 groupboxes enable/disable based on the value in a combobox.
This combobox however the behaviour for the group boxes only works when I leave the field by tab or click, not when the text changes.
I have tried using the Leave, TextChanged, Validated Events and everytime I have to actually "Leave" the field for it to perform the enabled/disabled of the groupboxes and their subsequent controls.
I need it so that when they choose 1 of the 3 options it immediately changes and doesn't work when they leave the field but when they choose the correct word.
Any assistance would be great I'm tearing my hair out here.
I think you are looking for the event on your combo boxes
SelectedIndexChanged
To stop the user from leaving an invalid field use the event
Validating
set the e.cancel to True if the validation fails
I've created one user control which have textBox & DatabGridView etc. When any user start typing in textbox then the filter is applied in DatabGridView. Now I want to add following features in this control how can I add these?
I want to use same control for supplier, customer, vendors on a single form, so I've placed it 3 times from toolbar. But for each control I want to fill different data from database. So what will be the best way to bind the control?
As we knew each table (customer,supplier & vendor) can have different columns, so I also need properties to set them. I've added property to my control but how can I ensure user has assign value in it? I.e. if user run the form and X property is not assigned to control then it should show message.
Note: I've tried it on control load event but didn't get any success because control's load event is occurred prior to form load and I'm assigning property on form load.
Please help....
I have a .NET WPF browser app page with 2 user controls. I want textbox.text in user control 2 to equal textbox.text in user control 1.
I have tried userctrl2.textbox1.text = userctrl1.textbox.text, but it doesn’t work.
I’m used to Windows Forms-based applications, however WPF works a bit differently. How can I set the textbox.text in user control 2 equal to the textbox.text in user control 1?
Why not do it the WPF way?
First text box control should bind to a property using two way binding.
Second text box control should bind to a property using one way binding.
When you type in a first text box, it will update the underlying property, and this will in turn notify the second text box control that the property changed.
I am coding an invoicing application. The user should be able to add a new line to the billing section of the invoice by selecting a product from a ComboBox, which subsequently fills out various other fields (price, description, etc) based on the selected product.
My problem is this: When the user adds a product, I would like the program to automatically generate a new line for the next product. It seems like the only way to accomplish this would be to create a new set of controls with an incremented name, i.e. Product1, Price1, Desc1 for the first product, Product2, Price2, Desc2 for the second product, etc. Is this possible, or am I going about it all wrong?
I had to do something like this at one point and what I did was create a custome user control, in your case it would consist of a combo box, that is filled with products on load, and all the related controls, which would be filled out on the selectedindexchanged event of the combo box. On your main form where you want to display this info place a panel and add your custom user control to the panels.controls collection.
since all the functionality will basically be contained in the usercontrol itself you shouldn't run into naming issues.
As for adding the user control when the user makes a selection, you could dim the control withevents and attach a custom event to the user control and handle it in the main form. since the controls would be added at run time you would need to attach the event handlers using the AddHandler call.
So to break it down you would need:
A Custom user control with all the controls you want for each product and an ID in the code behind
An event on your custom user control to tell the main form that the combo box has a selected value
A panel on your main form to hold the custom user controls
An event handler to add a new customer user control to the panel when a selection is made in the combo box.
if you want to interact with a certain product with the same button you can attach an ID in the code behind of the user control and set that everytime a new user control is added. this is not as hard it I think I make it sound, you can actually run linq on the panels control collection and get all the panels where any condition you designate is met and then do what you want from there.
As for your second question, I would assume your user control is pulling a bogus connection string from somewhere. I would try to track down where that is happening and go from there. Anything beyond that would just be a WAG and that doesn't really help you.