Datagrid not loading the form - vb.net

Here is the screenshot of it
Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'CustomerRecordsDataSet.CustomerRecords' table. You can move, or remove it, as needed.
Me.CustomerRecordsTableAdapter.Fill(Me.CustomerRecordsDataSet.CustomerRecords)
End Sub
First of all I'm just a newbie with VB. I tried searching for tuts and tried to use the datagrid. I created my MS Access document for the database and created the form so I linked the datagrid form to my main window but whenever I click the button for the datagrid form it shows InvalidOperationException was unhandled and it highlights this Me.CustomerRecordsTableAdapter.Fill(Me.CustomerRecordsDataSet.CustomerRecords).
Need an ASAP explanation thanks in-advance

The error is telling you what the problem is. The data provider isn't there (Microsoft.JET.OLEDB.4.0). This can happen if you don't have it installed, or you are running an "Any CPU" or "x64" application on a x64 system. Have you tried the ACE provider (Microsoft.ACE.OLEDB.12.0)?
Details: https://www.connectionstrings.com/access/
There are also many articles on that site that address various problems. For example: Jet for Access, Excel and Txt on 64 bit systems
The Microsoft OLE DB Provider for Jet and the Jet ODBC driver are available in 32-bit versions only. You can't run them in 64 bit mode.

Related

VB Forms don't recognize each other in the same project

Hi everyone I need some help,
I am having a weird situation every time I try to call a window form I get this error
BC30469 Reference to a non-shared member requires an object reference.
I was originally working on Visual Studio 2010 when the first time contouring this problem so I thought that I may accidentally deleted or edited some code in the declaration of the form witch caused the problem so I closed the solution and created a new one to make sure that the problem is limited the solution not to VS. then I add window form "Form2" then created/added a button1 on Form1 to call Form2.Show()
simple code that should work fine but when I tape Form2.Show() it give that ERROR and red mark Form2
so I uninstalled VS2010 then Reset Windows 10 with option to wipe out all data on windows partition (I now that was extreme but I suspected that maybe the system was infected with some virus "prior action") so after that I checked the system with HitmanPro and found nothing then I installed VS2019 Community and get The some problem I searched on the web but did not found any similar case so here I am hoping that someone will resolve the mystery.
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Form2.Show()
End Sub
End Class
Form2 is empty form I didn't make any change on it
Before this problem showing up everything work fine now even old project have the same issue
Thanks
Edit: Add project as simple
https://mega.nz/file/FgoXkCwA#ootxYrXGnR6sQR_Pifjvz617-r_Az1ozXWB49oGxqKU
the project dose not contain any executable file
I usually do something like this when calling a subform:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' using a Using block:
Using form2 as New Form2
form2.ShowDialog(Me)
form2.Close()
End Using
' using a With block
With New Form2
.ShowDialog(Me)
.Close()
End With
End Sub
ShowDialog(Me) keeps the subform open until a DialogResult is provided by the user (OK or Cancel usually).

Unlocking SQL Compact (.SDF) file when data entry form closes

I have developed a small Stock-Take application that runs on a Windows Mobile 6.5 handheld device & uses a SQL Compact 3.5 (.SDF) data file. I built the application in Visual Studio 2008 using VB.Net and it all works fine up to the point where I need to copy the data file back to the connected PC for further processing. When I close the application data entry form, the data file remains locked and I can't copy it to the PC. In the Form_Closed event, I am issuing Dispose commands for both the TableAdapter and BindingSource, and have also added a Garbage Collect command, see code below, but the data file remains locked.
Private Sub StockCheckForm_Closed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Closed
Me.StockCheckTableAdapter.Dispose()
Me.StockCheckBindingSource.Dispose()
GC.Collect()
MsgBox("Form Closed", , "Stock Check")
End Sub

Closing main form doesn't finish process (only some computers)

The problem is happening on 2 of the company's computers and on a client computer, but we can not identify a pattern.
I was able to reproduce the error using a simple program that only opens an OpenFileDialog. The program must be run by the generated executable itself (NOT by Debug) and it is still running in the background even after closing. Below is the code of the program, along with a link to download the project and a video demonstrating the error.
Code:
Public Class Form1
Private ofdAbrir As Windows.Forms.OpenFileDialog
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ofdAbrir = New Windows.Forms.OpenFileDialog
ofdAbrir.ShowDialog()
ofdAbrir.Dispose()
ofdAbrir = Nothing
End Sub
End Class
As you can see in the code above, I only have one form, so it is not the case that some form remains open and it is also not related to threads running since none is created.
To reproduce the problem, click on Button1, cancel the OpenFileDialog and try to close the form (clicking on X). The form apparently will close, but you will see at task manager that it still running. The big mystery is that this problem does not happens in all computers.
Video: https://drive.google.com/open?id=1sfdVUGQlwYNCQkl1Ht-cJSOb4433sqnT
Project: https://drive.google.com/open?id=1d4oJYUjaaZ9xnRj4CX3HXOQPqwMZmE0V
I couldn't reproduce the problem, but how about using this method:
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Using ofdAbrir As New Windows.Forms.OpenFileDialog
ofdAbrir.ShowDialog()
MsgBox(ofdAbrir.FileName)
End Using
End Sub
I've seen the video u posted...It is not your application that is running rather it is the vsHost.exe that is running :)...The problem shouldn't occur if u run the app outside visual studio.
If the problem is still there,just disable Enable Diagnostic Tools while debugging from Tools > Options > Debugging > Uncheck Enable Diagnostic Tools while debugging
Also u can disable Visual Studio hosting service from Project > Project Properties > Uncheck Enable the Visual Studio hosting service

Visual Basic Studio 2010: Sterling ActiveX Library

I'm new to Visual Basic, and I've run into an error. I'm trying to write a program that will eventually be run by and in Sterling Trader (stock-trading software). I'm trying to follow the instructions of the activeX API guide for including the reference to the library. Here's what the guide says:
Create a reference to the Sterling ActiveX Library
- Select Project ---> References....from the menu
- Select Sterling 1.0 Type Library from the Available References.
- If the Sterling 1.0 Type Library is not found, select Browse and find the Sterling.tlb file.
Enable Events
- Place the following line in the general section of your code to declare the object:
Collapse | Copy Code
Dim WithEvents m_STIEvents As STIEvents
Place the following line in an initializing procedure, such as the Form_Load procedure:
Collapse | Copy Code
Set m_STIEvents = New STIEvents
Now select m_STIEvents in the Object drop down control in your code window (top left drop down control). You will see the available events in the Procedure drop down control (top right drop down control). Select the event that you would like to catch and it will be inserted into your code. It should look
something like this:
Collapse | Copy Code
Private Sub m_STIEvents_OnSTIOrderUpdateMsg(ByVal oSTIOrderUpdateMsg As
ISTIOrderUpdateMsg)
Use the oSTIOrderUpdateMsg object to gather the information from the message.
However, for some reason I was getting errors in Visual Basic 2010 (the guide must be out of date). So basically, I blindly followed Intellisense to change my code to something that I hoped would work. Here's my code:
Collapse | Copy Code
Public Class Form1
Dim WithEvents m_STIEvents As SterlingLib.STIEvents
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
m_STIEvents = New SterlingLib.STIEvents
End Sub
End Class
For now, I'm just trying to get a basic program up and running that has successfully include the library. However, when I run this, I get the following error message:
"Retrieving the COM class factory for component with CLSID {5E89F49B-6A12-420F-8570-E510EF1B580A} failed due to the following error: 80070002 The system cannot find the file specified (Exception from HRESULT: 0x80070002)"
If I click continue, the program runs and the basic window displays. I can't find anything online for how to do this at all, please help!
Thanks
I had something similar. I turned off windows UAC and the error went away
see error list
http://web.archive.org/web/20100126001718/http://blogs.msdn.com/joshpoley/pages/errors-007-facility-win32.aspx
.NET 3.5 ActiveX dll InteropServices.COMException
You have to login sterling pro for the program to work. Also install VB6 would solve the COM problem. This API is too old. Sterling is too lazy to update.

VB.NET 2005 problems with Designer not being able to process a code line

I have a problem in my project with the .designer which as everyone know is autogenerated and I ahvent changed at all. One day I was working fine, I did a back up and next day boom! the project suddenly stops working and sends a message that the designer cant procees a code line... and due to this I get more errores (2 in my case), I even had a back up from the day it was working and is useless too, I get the same error, I tryed in my laptop and the same problem comes. How can I delete the "FitTrack"? The incredible part is that while I was trying on the laptop the errors on the desktop were gone in front of my eyes, one and one second later the other one (but still have the warning from the designer and cant see the form), I closed and open it again and again I have the errors...
The error is:
Warning 1 The designer cannot process the code at line 27:
Me.CrystalReportViewer1.ReportSource = Me.CrystalReport11
The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again. C:\Documents and Settings\Alan Cardero\Desktop\Reportes Liquidacion\Reportes Liquidacion\Reportes Liquidacion\Form1.Designer.vb 28 0
I would back up the designer.cs file associated with it (like copy it to the desktop), then edit the designer.cs file and remove the offending lines (keeping track of what they do) and then I'd try to redo those lines via the design mode of that form.
I would take out the static assignment in the designer to the resource CrystalReport11 and then add a load handler to your form and before setting the ReportSource back to CrystalReport11 do a check
If(Not DesignMode) Then Me.CrystalReportViewer1.ReportSource = Me.CrystalReport11
Here is a mockup..
Public Sub New()
InitializeComponent()
AddHandler Me.Load, New EventHandler(AddressOf Form1_Load)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
If (Not DesignMode) Then Me.CrystalReportViewer1.ReportSource = Me.CrystalReport11
End Sub
You should be able to take a backup, clear the lines that are having problems then when you re-open it the designer will fix the code.
The key is that you want to let the designer re-generate, then just validate that all needed lines are there.
That usually works for me, but you just have to be sure to remove all lines that it doesn't like.
I do an easy way; Right Click on the report then choose Run Custom Tool.
Automatically it fixes all problems and working for me, i solve 52 crystal ReportViewer errors.