How to fix position of scroll bar to bottom in DataGridView? - vb.net-2010

I am using Visual Studio 2010 and using Visual basic language and Service based database.
I am working on Database and trying to import data from database to DataGridView in windows forms in running mode of the application. I have three columns in database i.e ID, NAME, MARKS. Also, I have three search boxes in windows forms with the same names. The code for displaying data to DataGridView from Database is written in the event of windows forms which display all the rows of database in DataGridView whenever application starts running. I have one "Add Row " button in windows form whose event Handler contains code for adding data to database. In running mode of application, whenever I press "add button" then new row is addded to the database and also displays on the DataGridView. The newly entered row in database contains all the data that was entered in search boxes in running mode of the application.
Now the problem is that whenever new row is inserted to database and is displayed to the DataGridView, the scroll bar moves up which I don't want at all. Although, the DataGridView contain all the rows that were added later but it shows only specific number of rows of the database unless scroll bar is moved downward.
Please help me to get me out of this problem. I would be very thankful.
Waiting for your response,
Regards,
tariq.1000
DataGridView and Search boxes pic

Related

DataTable.GetChanges() not working as expected

vb.Net 4.6.1 -
Windows Forms App
I am trying to pick up some changes to a datatable on a form and I'm having some issues. I've gotten the functionality to work fine on a test form but I can't figure out the issue on my large form.
Assume I have a windows form with a combobox that shows a list of IDs and one textbox that holds the detail for the Id. The detail.text property is bound to a dataadapter. My problem is that when I change the text in the textbox and then check getchanges I see no changes.
I put a button on the form to check the datatable values on demand and they are changing but for some reason changes aren't detected.
Load the form, choose an Id in the combobox and the detail is loaded in the textbox.
Press the button and see the original value:
MessageBox.Show(DsSIngleJob.apGetSingleJob.Item(0).detail)
MessageBox.Show(DsSIngleJob.apGetSingleJob.Rows(0).Item("detail"))
Change the text in the textbox.
Press the button and the messageboxes show the new value.
Test for changes and none are found:
ApGetSingleJobBindingSource.EndEdit()
Dim JobChanges As DataTable = New DataTable
JobChanges = Me.DsSIngleJob.apGetSingleJob.GetChanges
MessageBox.Show(JobChanges.Rows.Count.ToString)
If, instead of changing the text on the form, I write it directly to the datatable before I EndEdit then the changes are picked up:
DsSIngleJob.apGetSingleJob.Rows(0).Item("detail") = "NewValue"
Since I have it working on a test form it has to be some issue with the main form or the associated dataadapter but I've been messing around with this all day and I can't get it to work. If anyone has something worth checking that would be great. I checked the form for any applychanges or loads after the textbox is manually changed but I didn't find anything.

Need prompt to save changes in Windows form when changing displayed record

I am relatively new to programming, so this may be an easy one. I have a Windows form that connects to SQL Server and displays the data in a form where a user can edit and add or delete records (via databinding). The form works well, and has record navigation controls as well as context menus that allow the user to filter data on any field.
Currently, the user can make changes and switch to new records, etc... but changes are not applied until the user clicks the "save" button. However, I'd like to prompt the user to save records whenever the user navigates to a new record (either through navigator or through application of a filter which displays a different record).
What event can I use that will trigger whenever a different record is reflected in the form?
Thanks,
Jay

How to edit a record through a form on MS Access?

I'm new to Microsoft Access and I'm having a trouble implementing something.
Basically, I have a form with a combo box, some text boxes, and a command button.
What I want to do is have the user select a record from the combo box, which then populates the textboxes (I've already managed to do this). Once the data has loaded into the textboxes, I want the user to be able to edit the info in the textboxes, then press the command button so that it updates that record in the table.
This looks like the same odd form where you had trouble with delete. It sounds like you are working from the wrong end. Create a form based on a table or query, then add a combobox to find records on the form based on the selection. There are wizards to guide you through. You will then have a standard Access form where everything works as expected. When textboxes are changed, the data will be updated as soon as you move to another record, there is no need for save, it is the default for Access.
If you wish to use non-standard unbound controls, you will need to update with SQL or stored queries.

vb.net combobox data changes

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.

How to freeze one or more columns in MS ReportViewer control?

Is it possible to "freeze" a column in Microsoft ReportViewer control local mode so that as the user scrolls to the right the first column or two continues to show and doesn't scroll out of view? I am using table type of report.
I found solution.
You have to click on the column above the header of the report designer. It will select whole column including Table Header, Table Details, Table Footer and click on the property (F4). Change FixedHeader Property to True.