vb.net combobox data changes - vb.net

I am making my final year VB.NET project, I am using Visual Studio 2008 with 3.5 framework
I am making a Restaurant Bill generation software.
I have created the table in SQL and connected to the project, I added 6 combo boxes with drop down,
I have assigned drop-downs as the Menu item of the restaurant, when I run the program and try to change one combo box item, all combo box items get changed. How can I avoid this?
How to get rid of this?
I am not a professional in this, but any help will be appreciated

I would guess that you've bound them all to exactly the same BindingSource (which is pointing at the same data), in which case changing the selection in one combobox will immediately be reflected in the others. If you have multiple items bound to the same BindingSource (which is what the wizard will give you if you're not careful), and don't want a change in one to reflect in the others, you need to create separate BindingSources for each one.

Related

Can't change code copied from form in different database

Building a Maintenance log book in access. Had to redo a data entry form so I started over with a new form in a new database then copied some working code from the old form to the new. In doing so I changed the names of a couple of combo boxes in the new form in order to keep things consistent. Problem is, the code I copied has the old name of some of the combo boxes and I can't change those names to the new names. The new names don't present when using autofill, just the old ones. Is there a way to correct that.(Easy, I Hope)
Example: in the old form the name of a combo box was actionCB. In the new form the box is named ActionCB, but now any code I write uses the old name.
This might be happening because you have compilation errors. Try compiling the application and fixing any errors. Or possibly this could happen if you happened to be stepping through the code at the same time (but I doubt it from your description)? Also VBA is beautiful in the fact that almost always you can make code changes while stepping through the code... but I've experienced the changes not saving from time to time.
MODIFIED FOR NEW QUESTION
As to your second question below in the comments. You can view and select a Form or Reports controls by using the Forms Property Sheet. If you look at the combobox at the very top of the property sheet it lists all Form or Report controls. You can select these objects by simply selecting them from the combobox.
Access is not case sensitive
"Example: in the old form the name of a combo box was actionCB. In the
new form the box is named ActionCB, but now any code I write uses the
old name."
If you're code is not updating to reflect the "ActionCB" name automatically, then you're probably trying to reference it where it's not available. This isn't going to generate an error if you don't have Option Explicit statement at the top of your module.
It'll just assume you know what you're doing and assign it to a Variant data type.
Put Option Explicit at the top of all your modules, and the debug | compile untill all errors are fixed.

Binding data to a control within user control in VB 2013

I have designed a user control in Visual Studio 2013 (VB) . The control contains three Combobox controls through which user can select different values. I bind each combobox to a specific table field in my database (SQL Server) through assigning each combobox's properties [DataSourse, DisplayMember, and ValueMember] the required values. I already created a DataSet.
When I add multiple instances (about 26) of my user-control to a form and run the application, the comboboxes SHOW nothing! as if they are empty. To make sure, I added a Combobox control on the form itself (where user-control instances added), and bind it the same way above, and .. mmm it works!
I'm not able to explain the reason behind this strange behaviour.
I appreciate any assistance.

Insert/Remove item in listbox bound to database

I want to be able to reorder my listbox which is bound to my sql ce database by clicking up and down arrow buttons. Since my listbox is populated directly from my database using the entity framework, I think I have to delete the object (from the listbox) and reinsert it (in the row above) if I want to move the item up the list.
I have no view model, my listbox is populated directly from my database in my code like this:
listBoxProperties.ItemsSource = entities.Properties.ToList();
Does my question make sense?
Cheers
ormally you would handle the moving of your list item in your view model which would hold the ObservableCollection the control was bound to - and then that would be reflected in your control via the binding.
It is going to get messy trying to accomplish this dirrectly on the control - which is your only way since your binding to a throwaway copy of the EF properties list.
As your UI dev goes on you are only going to run into more issues like this. I strongly recommend getting a view model in place sooner rather that later.

Adding several datasource on same column in DataGridView

I'm working on VB .NET 2008.
Target: Bind dynamic datasource in a cell of a Windows.Forms.DataGridView depending on the selection in previous column. The grid must have 7 columns. If the selection on comboboxcolumn 2 or 4 is done, the datasource of comboboxcolumns 3 and 5 mus change using a query with previous selection as parameter.
In a first try to develop this functionality i've tried to use Telerik.WinControls.UI.RadGridView control. I've created a customized celltemplate with a combobox in order to have different datasource for each cell on the same column. All worked fine but seems to be some kind of bug in RadGridView, because when the combobox is presenting the list, after selection the list continued showing, doesn't dissapears as expected.
Ok, after several days of fight with RadGridView, I give up, and I tried to use same strategy but using Windows.Forms.DataGridView. I've created two classes one inherited from DataGridViewComboboxCell and other from ComboBoxColumn, in order to insert my own combbox or have the chance to have access directly to the combobox values. But the combobox showed is the default combobox not my own combobox.
Anyone knows how can I create a custom comboboxcell but using my own combo, and having access from outside to this combo?
Thanks in advance.
Regards.
You might be overwhelming the abilities of your controls. You can always break them out into parent/child or master/detail grids instead of keeping them combined into one.

Winforms checkbox Databinding problem

In a winforms application (VB, VS2008 SP1) i bound a checkbox field to a SQL Server 2005 BIT field.
The databinding itself seems to work, there is this litte problem:
user creates a new record and checks the checkbox, then the user decides to create a new record (without having saved the previous, so there are 2 new records to be submitted) and checks also the second.
Now the user decides to save these records: the result is that only the second record keeps the checked value, the first one is unchecked! (i tried the same with 5 records: the result is the same, the first 4 records are unchecked and only the last one keeps the checked state).
What do i miss??
Thanks in advance
Sounds like a bug in winforms binding mechanism. There're more like these around (numericupdown, menu item checks bindings, etc).
You can probably workaround by registering an event on switching to another row, and manually read it from the UI and put into the table.