I have a DataGridView form (System.Windows.Forms) in VS2012 (VB) that looks fine when I Preview it in VS:
Yet when I recompile and run the program, the latest line I added to the Access file is missing (ID 19, which I added as 20 then pushed it to 19; ID 20 is always hidden). The data source is an Access file with 1 simple table.
Here's what it looks like in the recompiled program:
As you can see, there is still 1 row missing. And row 20 is still correctly hidden, which is right. But I'm not sure why the new row (19) is still missing.
I believe the Fill() and GetData() function are all standard. Any thoughts?
The rest of the form works fine; it pulls numbers from the Access file and updates (Refresh) them on the program display.
It took a while to find, but I dug out this line in a refresh function:
xxxxxx.Filter = "ID < 19"
And change it to 20.
Related
my VB programm works fine, then I had to add 4 new boolean fields to a table in Access2010.
I updated the datasource and the preview of the dataview works fine (Visual Studio 2019).
But unfortunately my DataGridView doesn't work anymore.
I deleted the DataGridView and created a new one with the ame name but it doesn't help.
I still the message : "No value given for one or more required parameters."
What can I do ? I checked the columns name and everything is ok ?
WinForm, VB.Net, VS 2017
I used the dataset wizard to create a dataset. I dragged the dataset to a new form to populate a grid. I did another drag of the detail fields. The form works OK. I then edited the dataset and removed a field from the middle of the record. When I load the form no records are bound.
I added MyApplication_UnhandledException but it did not fire either.
Any clues to what might be wrong? Looks like a low-level bug to me.
I was able to reproduce the bug in VS 15.4.2
0 new Winform VB.Net
0 Add/Configure Dataset via wizard
0 add table using defaults
0 drag fields to create grid on form
0 drag fields to create detail fields
0 set as startup form
0 run - check to see navigator, grid and details function
0 edit added table - remove field using the query designer (not the first of last field - guess)
0 run - nothing works
Using Visual Studio 2015 (VB) with SQL Server 2012. This is going to be complicated please bear with me.
My questions is why wont my gridview update?
I have a web page that creates txt files in a remote server location. These files are then picked up by a separate (third party tool) which sends them to a government body. The government body then sends a receipt file for each txt file which my web app then picks up and records the result. The result is either an acceptance or a rejection.
On the web page I provide a gridview showing the last ten results and if I send 1 file at a time (with every click of the button) my gridview will refresh without issue showing the results of the receipts. There can be up to minute gap between the creation of the file, the file sending and the receipt being received.
The image below shows an example of my gridview after successful submission and receipt.
As the button is clicked the sent and accepted column display as red with 'No' within them.
When the button is clicked to send the file a sub is processed that creates the file. A timer is then enabled (fires every ten seconds) that runs another sub to check for sent and receipts. I have no issue with this as it works as expected and each cell within the gridview changes to reflect the sent and receipt status.
This is done using a call to build the gridview.
The call
displayLastSentGridView()
displayHistoryGridView()
historyUpdatePanel.Update()
One of the subs to build the gridview
Public Sub displayLastSentGridView()
Dim mlastSent As New lastSent
Dim mLastSents As New List(Of lastSent)
mLastSents = mlastSent.lastSentGridView
gridLastSent.DataSource = mLastSents
gridLastSent.DataBind()
End Sub
Ok so a request came in that when a particular file is created a further 4 are generated (with a different layout) and auto sent. I have implemented this and it works as expected. I then use a new sub to check on the status of these files (as their classification is different). When the file is sent the web page updates the database flagging the entry as sent, when the receipt is accepted it flags it as accepted. My problem occurs here. I use the same code as above to call the gridview updates when the sent even occurs and when the acceptance comes in but the gridviedw does not update.
If I place the code at the end of the sub routine all the cells update i.e. it will update the gridview in one go and all the cells turn green with Yes inside them, but i want it to update each cell as the database notifications are changed.
Below is an excert from my code that checks the folder location strSentFileLocation if it exists the database is updated and then the call to update the gridviews is made. The database update works but the gridview doesnt change.
If File.Exists(strSentFileLocation) Then
db.ngc_updateActivityLogSent(True, seq)
db.ngc_updateActivityLogRejected(False, "N/A", seq)
db.ngc_updateActivityLogAccepted(False, seq)
'update gridviews
displayLastSentGridView()
displayHistoryGridView()
historyUpdatePanel.Update()
End If
My update panel is set to conditional.
Any help greatly appreciated. Thanks
UPDATE
For info the IF statement is nested within a FOR loop.
The from was the for loops, as the sub never actually finished the update panel never got chance to update till right at the end. I have removed the for loop and added in a hidden field that I increment and call the sub until the hidden field reaches a specific value.
I am trying to compare the original and current value for a data bound text box. I've done a bit of research and tried a few methods but I can't seem to get it to work. I'm using vb.net via Visual Studio 2012. Database is running on a SQL 2012 server and I'm using a stored procedure to provide the data.
Fill statement:
Me.SpGetEmployeeTableAdapter.Fill(Me.DsEmployee.spGetEmployee, cboEmpId.SelectedValue)
My textbox is called txtLastName and txtLastname.Text is bound to spGetEmployeeBindingSource.LastName
I have a method that handles txtLastName.LostFocus so I can watch the values as follows:
Private Sub LastName_Out() Handles txtLastName.LostFocus
Dim x as String
x = "Hi" (breakpoint)
End Sub
I run the app and load the data for employee Smith using the fill above. I go to the text box, change it to Jones and tab out. I hit the break point above and check the values in a Watch window:
me.DsEmployee.spGetEmployee(0)("LastName", DataRowVersion.Original).ToString
me.DsEmployee.spGetEmployee(0)("LastName", DataRowVersion.Current).ToString
Both lines show Smith as the value but on the screen you see Jones.
My research indicated that I may have to run EndCurrentEdit to push the textbox.text value down to the dataset but I've had no luck. The following are three examples of how I tried to end the current edit but so far the values stay the same and the dataset doesn't pick up the changes:
BindingContext(Me.DsEmployee.Tables.Item("Me.DsEmployee.spGetEmployee(0)")).EndCurrentEdit()
BindingContext(Me.DsEmployee.spGetEmployee.Rows(0)).EndCurrentEdit()
BindingContext(Me.DsEmployee).EndCurrentEdit
I have no doubt at all that I'm doing it wrong but I sure would appreciate a leg up.
Thank you!
I ran a couple of tests and actually got this working. Here is what I needed to do before testing the "Current" data row version:
me.SpGetEmployeeBindingSource.EndEdit()
Once I ran that line of code I could test for the value in DataRowVersion.Current and I could see the new value. Additionally when I check me.dsEmployee.HasChanges it returns True when it returned False without the EndEdit.
I have an Excel 2007 sheet with VBA user forms to get data from access. Everything works fine. Data also gets populated over VBA form but when i click on any Multi-page tab then it throws the following error (though i can see values were loaded successfully):
Run time error 35788. An Error occurred in a call to the Windows Date & time picker control
How can I fix this?
Note: I have used Me.Multipage.Value = 0 or 1 as per page index before code executes for multipage tab. e.g. before 2nd page code execution i set index as 1.
When i click over user form field name on debugging then it highlight as 12:00:00 AM & access field name shows correct date value.
Finally i got this working with little more head beating. I added Me.Multipage1.Value = 0 in the last of code & it started working. Though i think it should not have anything with error i received above but i got this working. Anyhow. Thanks.
May be this helps someone else running with same trouble.
The date time picker needs to be shown before the added value, so if you have a multi-page user form, you need to show the page containing the date time picker first.