|
In the project properties, what is the startup form/module?
|
|
|
|
|
frmMain is the startup form on all projects include the failing one and the working ones.
|
|
|
|
|
QBTeKcom wrote: It goes into some CheckChanged events on frmMain so I assume the form is instantiated.
Wrong assumption; might fire from the constructor if it has been hooked up in the InitializeComponent -method.
Bastard Programmer from Hell
|
|
|
|
|
OK, then please tell me how I can make it work like the other programs. What do I need to change or look at or something??????
|
|
|
|
|
QBTeKcom wrote: OK, then please tell me how I can make it work like the other programs
It is already working "like" the other programs, you said that yourself:
QBTeKcom wrote: This works in 6-7 other programs and has for years but crashes with indicated error
There are no errors when we do a build.
I'm guessing that the type initializer (the constructor) for frmMain threw an exception that you did not handle. It might be in an event that gets triggered by an action in the constructor. After the InitializeComponent the form has been created, and all events that are coupled from the IDE will be firing (like TextChanged and such)
Put a breakpoint in there and verify each statement, or move all/most of the code from the constructor to a separate initialization-method that you call.
QBTeKcom wrote: This technique worked in many other programs but not this one. Not sure why.
The applications aren't identical, or they would behave identical. I'm guessing different constructors, but there "has" to be something that causes it.
QBTeKcom wrote: What would cause the modules to be executed first before frmMain is instantiated?????
Are you using the modules from the constructor of frmMain?
Bastard Programmer from Hell
|
|
|
|
|
Never said the programs were identical but that they use the same technique.
I know something must be doing it but don't know what nor how to determine which is why I am posting on the forum.
Not touching any constructor's for any forms.
|
|
|
|
|
Put Try catch around the InitiaizeComponent for frmMain and nothing was caught. I did put a break point on the Try and it stopped there but no error. I know that the module with the frmMain is failing but nothing is caught.
If I leave out the = frmMain then FormMain has a value of nothing.
|
|
|
|
|
Make it a "= New frmMain()", you don't want the default instance.
Bastard Programmer from Hell
|
|
|
|
|
Workaround found.
We took out the = frmMain from the module and moved it to frmMain itself. That seemed to solve that part. We are now debugging other VB6 conversion issues.
Not sure why the other programs worked.
|
|
|
|
|
QBTeKcom wrote: Workaround found.
We took out the = frmMain from the module and moved it to frmMain itself. That seemed to solve that part.
Well done, and thanks for posting what caused the issue
QBTeKcom wrote: We are now debugging other VB6 conversion issues.
Tedious work, but rewarding once it's done. Good luck
Bastard Programmer from Hell
|
|
|
|
|
I still would like to know why this one failed and all the others worked.
What would cause the module to be invoked before the frmMain constuctors?
Do anyone how a clue?
|
|
|
|
|
QBTeKcom wrote: I still would like to know why this one failed and all the others worked.
Simple; it does something different from the others, or they would fail equally.
QBTeKcom wrote: What would cause the module to be invoked before the frmMain constuctors?
Modules can't be "invoked", methods within the module can. I'm doubting that the module has it's own constructor (similar to a static class) - so what method is getting called?
Your app begins on it's entry-point, and might have a StartUp[^]-event defined. Next, it'd load the main-form, and all controls on it.
If any of those touch a module, it'd cause initialization of that static class. In other words; calling a method from a module for the first time would cause it to be loaded, no sooner. Finding out is done by stepping through your code. Press F10 to start your project and execute it step by step and line by line.
I can give better advice if you posted your code, especially the method where the form is created
Bastard Programmer from Hell
|
|
|
|
|
It is all happening before any 'user' code except the changed events for the controls and they just usually exit. The same applies to all the programs.
I am not following the rest of what you are saying to know what I should do in the future.
What code would I post? It is a very large program 30 screens with code behind and 40 other modules. But fails in the startup frmMain.
I have posted what the flow is. frmMain .load is the first user code.
|
|
|
|
|
QBTeKcom wrote: It is all happening before any 'user' code except the changed events for the controls and they just usually exit. The same applies to all the programs.
Are you using any third-party controls? Are you referencing any other libraries?
When you go to the projects' properties page, on the tab "Application", is there a checkbox "Enable application framework"? Is it checked?
QBTeKcom wrote: I am not following the rest of what you are saying to know what I should do in the future.
You need to familiarize yourself with the debugger[^], and step through the code so that you can see what's being executed, and in what order.
QBTeKcom wrote: What code would I post? It is a very large program 30 screens with code behind and 40 other modules. But fails in the startup frmMain.
Then post the "startup frmMain"; or the lines of code that you changed that you were referring to earlier in this thread.
The stacktrace mentioned in the exception-box would be nice too
QBTeKcom wrote: I have posted what the flow is. frmMain .load is the first user code.
The flow doesn't say anything about the origin of the error, and this is not a helpdesk.
Bastard Programmer from Hell
|
|
|
|
|
Dearest VB GuRus,
thanks for all your contributions. this time, I have a problem and I need your magnanimous assistance and contributions.
I have developed a a VB Cash-expense application and I am designing a Database using MS-Access to be used as back-end.
I am confused on which fields should BE in the following tables below.
Table1: Department (This table has all the departments that are eligible to receive cash and make purchases.)
Table2: Items (this table has all items that are purchasable by all the departments.)
Table3: Purchases (This table SHOULD record all purchases made by individual departments.)
Table4: ReceiveableCash (This table SHOULD record all receivable cash that comes into the organisation (NOT THE DEPARTMENT).
Table5: PayableCash (This table SHOULD record all financial expenses made to a particular department.)
Table6: Accounts (This table records all the currentBalance, accountName and the AccountCode of different accounts. Every financial transaction is through a particular account.)
Kindly help me on the design of the above tables.
I do not know which fields should be included in the respective tables.
But my conception is:
Department:
DeptID
DeptName
Items:
ItemID
ItemName
Purchases:
PurchaseID
ItemID
PurchaseDate
Amount
PayableCash:
PayID
DeptID
Amount
Date
ReceiveableCash:
ReceiveID
Amount
Date
Accounts:
AcctID
AcctName
CurrBal
I do not know what SHOULD constitutes these table above and I really need your kindest assistance in the design.
Moreover, I also need to know the how to construct an SQL SELECT statement that will retrieve all expenses made.
Thank you.
Eyo Honesty
|
|
|
|
|
Eyo1 wrote: Dearest VB GuRus
You be wanting the database-guru's. (Aaaargh/Avast/more grog?)
Eyo1 wrote: I do not know which fields should be included in the respective tables.
Google for "normalization", it'll provide steps to get from an unorder collection of facts to a normalized model (so help me Codd). It won't take more than a day
Bastard Programmer from Hell
|
|
|
|
|
Ok, I've search Far and wide and have been unable to find a clear answer. What I want is to have a URL opened into my Custom tab controlled browser(Form1.vb)
From a link in my Main form (mainform.vb). I found the code to have it opened in a non tabbed control browser, but not for a tabbed controlled one which was:
Private Sub WebBrowser1_NewWindow(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WebBrowser1.NewWindow
Dim myElement As HtmlElement = WebBrowser1.Document.ActiveElement
Dim target As String = myElement.GetAttribute("href")
Dim newInstance As New Form1
newInstance.Show()
newInstance.WebBrowser1.Navigate(target)
e.Cancel = True
End Sub
I am using Visual Studio 2010.
|
|
|
|
|
|
That only shows how to open a browser from another form. I want it to open the browser and navigate to the specified url.
|
|
|
|
|
I'm a little confused as all the parts are there.
If you are in main form, you open the browser (form1) if it is not already open and navigate to the url.
If you are in main form, and the browser is already open, send it the link via a public method, create the new tab and navigate to the url passed in via the message.
The article I linked to will show how to handle multiple tabs, and the rest is standard form interaction.
|
|
|
|
|
I'm not sure if you've understood my question correctly. I'll try explain it a bit more.
I have made a web browser that uses tabcontrol in "form1".
"mainform" is where I want to access the browser from, normally you would just use "form1.Show()" on the button, and it would open the browser form.
However I want it to open the browser "form1" and navigate to a specified url. The code I supplied only works with a browser made without using tabcontrol.
Hopefully I've explained it well enough now.
Thanks,
Brad
|
|
|
|
|
And my answer before this one, tells you what do to to achieve this.
See this article on how to pass values between forms if you are unsure of how to do this; Passing Values between Forms in .NET 1.x with C# and VB.NET examples[^]
On the browser form, read the url, create a new browser tab and then fire of the browser control navigate to the method (the same way as you would be doing at present).
|
|
|
|
|
I'm really hoping someone is able to give me the code. I looked at that link and I saw how I was able to get a url into the address bar, though not navigate to it.
|
|
|
|
|
|
It's a tab control browser. It doesn't use webbrowser1. And everytime I put tabcontrol1.navigate("url") it give me the error that navigate is not declared in form1.
|
|
|
|