|
An unhandled exception of type 'Sytem.OutOfMemoryException' occured in System.Windows.dll
Additional information: Error creating window handle.
--- what does this mean? how i came up with this when all my code did was "form1.show"
|
|
|
|
|
Are you doing anything in the load/paint event of the Form?
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG picture :: my first abstract photo
|
|
|
|
|
alryt, this is an MDI application...
the parent form calls the child form in the event menuItem_click w/c goes like this : childFrom.show
in the load event of the childForm, i have this code :
Me.StringForToolbar = "10000000100" , w/c is used by parent form to setup the tool bar. but even though i remove this, same thing happens.
... i never used the Paint event of my forms.
|
|
|
|
|
oh, ive found out the cause in the event of the parent form OnMDIChildActivate. here's the code:
'Reset tool bar of parent using the stringFortoolbar of child
'This event is still being called when the form is being closed using the control menu
If Me.ActiveMdiChild Is Nothing Then Exit Sub
Dim objName As String
objName = MyBase.ActiveMdiChild.GetType.Name()
If objName = "ReceivingOrders" Then
Me.ResetToolbar(RRChild.StringForToolbar)
ElseIf objName = "MaterialIssuance" Then
Me.ResetToolbar(MISChild.StringForToolbar)
ElseIf objName = "TransferToAccounting" Then
Me.ResetToolbar(TransferAcctChild.StringForToolbar)
End If
... if i remove this, no error will occur.. pls. give me an alternative strategy for this. refer to the comments... and when shall i use the events OnMDIChildActivate and OnMdiChildActivate? tnx very much.
|
|
|
|
|
I'm getting the error bad dll calling convention when I call my dll written in vc++ from my vb app. The problem is because of the type / structure I'm passing my dll.
In vb, I've defined my call to the dll and created a type in vb that looks like this:
<br />
Declare Function test Lib "C:\TEMP\EngineTest\PSAEngine.dll" Alias "_test@10004" _<br />
(ByVal j As Integer, ByRef collateral As collateralvar)<br />
<br />
<br />
Type assetvar<br />
cutoff_prin_bal(400) As Double<br />
orig_gross_rate(400) As Double<br />
orig_amort_term(400) As Double<br />
End Type<br />
<br />
Type collateralvar<br />
subissue(100) As Integer<br />
asset As assetvar<br />
End Type<br />
In my VC++ dll, I've defined my function and structure as:
<br />
extern "C"<br />
{<br />
__declspec( dllexport ) void test(int j, collateralvar collateral);<br />
}<br />
<br />
struct assetvar<br />
{<br />
double cutoff_prin_bal[400];<br />
double orig_gross_rate[400];<br />
double orig_amort_term[400];<br />
};<br />
<br />
struct collateralvar<br />
{<br />
int subissue[100];<br />
struct assetvar asset;<br />
};<br />
Here is my call to the dll function:
<br />
Static collateral As collateralvar<br />
.<br />
.<br />
.<br />
test 0, collateral<br />
When I call the function test in my vb program it returns the error Bad DLL calling convention. Any ideas?
|
|
|
|
|
use __stdcall in the function you declare in c++ to solve the calling convention problem
|
|
|
|
|
<br />
void __stdcall test(int j, collateralvar collateral); <br />
This doesn't work because your back to not being able to find DLL entry point.
It must be declared as
<br />
__declspec( dllexport ) void test(int j, collateralvar collateral);<br />
|
|
|
|
|
OK. I've gotten into the vc dll. I added a struct command and made it a pointer.
vc dll
<br />
__declspec( dllexport ) double test(int j, struct collateralvar *collateral)<br />
vb declare
<br />
Public Declare Function test Lib "PSAEngine.dll" Alias "_test@8" _<br />
(ByVal j As Integer, ByRef collateral As collateralvar) As Double<br />
Now my problem is changing the values inside the dll's collateralvar struct and having vb see them. I'm passing the structure by reference so it should work but its not. Here is what I am doing inside the dll function:
<br />
__declspec( dllexport ) double test(int j, struct collateralvar *collateral)<br />
{<br />
collateral->asset.cutoff_prin_bal[j]=14;<br />
<br />
return(1);<br />
}<br />
from VB I'm calling the dll this way:
<br />
dim x as double<br />
collateral.asset.cutoff_prin_bal(0) = 423149.74<br />
x = test(0, collateral)<br />
I still get 423149.74 instead of 14.0
|
|
|
|
|
Hello,
I have zero to little experience with Visual Basic but have a greater amount of experience programming with Visual C++ and other languages and I have a few questions.
1. Would it be a waste of time for me to learn VB 6.0? Should I instead go directly to learn VB .NET?
2. Can anyone suggest any good books for me to read? (Preferably books for beginners to VB).
Thanx for the help,
-Flack
|
|
|
|
|
If you HAVE to learn VB I would move to VB.NET. If you have a choice and already have a more C++ oriented background go to C# instead.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
I agree.
Go for C# or MC++ (Managed Extension for C++) if your project requirement is not forcing you to go for VB.NET.
anyway..
Professional C# for Wrox is one of the good book I have gone thru.
HTH,
Regards,
NetPointer
|
|
|
|
|
Now wait a second there... (I hate it when I am misunderstood)
What I said was if you have to learn a .NET based language for a project and already have a good C++ background then C# will probably suit you better.
I could haev conversly said that if you have to learn a .NET based language for a project and you have a good VB6 background then VB.NET would be best suited to learn.
Sheesh...
You almost made it sound like I was recomending C# over VB there.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
Hi,
I am developing a desktop application using VB.Net and using MS Access as
the database. However some of users do not have MS Access installed in their
computer. How can I deploy the application to those users without Access
installed in their PC? Do they have to install at least Access RunTime?
I wolud appreciate if any one can give me some idea.
Many thanks
Zengfu
|
|
|
|
|
To deploy a .NET app with Access to a clean user's PC they'll need:
* relevant version of .NET framework
* latest version of MDAC_TYP.exe (redist of ADO.NET)
* the MS Access .mdb file
That should work fine.
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG picture :: my first abstract photo
|
|
|
|
|
I have a DLL created in VC, I need to call it from vb. I've declared the dll functions in vb like this:
<br />
Declare Function PerfBal Lib "PSAEngine.dll" (ByVal oldperfbal As Double, ByVal NewDef As Double, ByVal VolPrepay As Double, ByVal ActAm As Double) As Double<br />
My VC++ function is:
<br />
__declspec( dllexport ) double PerfBal(double oldperfbal, double newdef, double volprepay, double actam)<br />
{<br />
double result;<br />
result=oldperfbal-newdef-volprepay-actam;<br />
return(result);<br />
}
Whenever I call it in my vb, it gives:
Run-time error '453':
Can't find DLL entry point PerfBal in PSAEngine.dll
The dll is in the same directory as my vb project and executable. I even placed the dll in the system32 direction.
I've tried to register the dll, all I get is psaengine.dll was loaded, but the dllregisterserver entry point was not found. Dllregisterserver may be be exported, or a corrupt version of psaengine.dll may be in memory.
What am I doing wrong??
|
|
|
|
|
Use dumpbin /exports on the DLL to find out if the name(s) of the DLL functions were mangled. You'll probably find that they were.
Modify your DLL's .def file to include specific
PerfBal = PerfBal
type lines and rebuild. This may well make a difference.
Steve S
|
|
|
|
|
Great! That works.
Is there a way to have the VB app find the dll without specifying the exact path to the dll in the declare?
|
|
|
|
|
Yeah. The .DLL must be in the same directory the VB .EXE is in, or in a directory on the PATH statement somewhere. But you can't have VB "hunt" it down if it is not found because you can't modify the Declare statement in code.
RageInTheMachine9532
|
|
|
|
|
I find that if I don't specify the exact path even if the dll is the same directory as the exe it still can't find it. Is that correct?
|
|
|
|
|
Never had a problem with it. I've built several VB6 projects using libraries I've built into C .DLLs. All I ever had to do was put the DLL files into the same directory as the project and add a reference to the DLL's or to their Type Library files.
RageInTheMachine9532
|
|
|
|
|
I am trying to create an application that allows the user to lookup different email client / messaging systems to allow them to import a list of contact details.
Outlook is easy enough to do but I am having some problems trying to find resources for Lotus Notes and Novell Groupwise. Has anyone tried something similar to this and can offer some light on it?
Thanks in advance!
Matthew
Live to ride. Ride to live.
|
|
|
|
|
I am sorry for asking such a trivial question, but here it goes. I have a form in vb.net that I would like to be by start up object. Every time I try to compile I get Sub Main not found. Is there a project option or something I need to set in Visual Studo.NET? If so where is it?
|
|
|
|
|
Click on your menu Project -> Properties. You Project Property Pages will show. Select Common Properties -> General in the left pane. You can then see a property called Startup Object in the right pane. Select the form you want as the startup object and click Apply.
On a side note, this is in the Help provided by the IDE. You could have solved this quicker if you looked there first
God, I pity me! - Phoncible P. Bone
If I end up Windows ME someone is going to be hurting. - One of the answers to a question for What OS are you
|
|
|
|
|
Hello All
I want to know if is there anyway to get the string length in Points?
I have the string str = "hello"
and if you call str.length, and will get 5
I know that str.length return integer.. but i want it in points..
Is 5 points equal to what str.length ( which is 5 in this case ) return in Integer ??
|
|
|
|
|
Hi,
Currently, I am using visual studio.net to program. The language used is vb.net.
I need to build an application that allows me to print preview an image and then print the image out. I have draged in a PrintPreviewDialog control from the toolbar and also a OpenFileDialog control for me to browse the image that I want to preview and print it out.In my codes i wrote the followings:
Codes:
PrintPreviewDialog1.ShowDialog()
Dim printDoc As New PrintDocument()
printDoc.DocumentName = OpenFileDialog1.FileName
PrintPreviewDialog1.Document = printDoc
However, the above codes work well for text document and not for image. If I choose an image, the output shown was a white blank piece of paper. Is there a way to change the printpreview dialog settings or there are any alternatives to preview and print an image file? Thank you in advance.
|
|
|
|