|
No, Thank You!! I learned something new today
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
The Following bit of code:
' int nalg = 10
' int* score = new int[nalg];
'
' for (int n = 0 ; n < nalg ; n++) score[n] = 10*(n+1);
'
'
' // call the function
'
' int fusion_score;
'
' Fusion_Method(&nalg, score, &fusion_score);
How would I write this in VB. Fusion_Method is a function in a C Dll that I am "loadLibrary "ing into the VB calling code.
Thanks!
Appreciate your help,
ns
|
|
|
|
|
Perhasp you can try with the varptr to pass the pointer into the Fusion_Method function.
K-PAX? CHANGE THE WAY YOU LOOK AT YOURSELF, OTHERS & THE WORLD...
|
|
|
|
|
Thanks in advance,
I'm trying to author a DLL plugin for an existing application that was written in C. In other words, the C code can not change. Unfortunately, the app doesn't implement COM and I'm writing the DLL in VB6 which only implements ActiveX DLL (using COM). The app does support loading all the DLL's in a certain directory and I've got a sample header file for the function call syntax. Unfortunately, I know VB and not C so I'm trying to convert the header into VB.
I've found a way to export the functions from my DLL and the calling app does recognize them, so step 1 is out of the way. The next step is to manually initialize COM on the calling thread so VB will play nice? Then TLS can be loaded?
I think these are the correct steps but obviously, I'm having implementing them. Does anybody have any leads, examples and/or links where I can learn about this more? Surely somebody has written VB plugins for a C app?
Thanks
Joe
|
|
|
|
|
if the C code can not be change, then you how invoke the VB DLL in your C app?
K-PAX? CHANGE THE WAY YOU LOOK AT YOURSELF, OTHERS & THE WORLD...
|
|
|
|
|
K-PAX, Thanks for responding.
As mentioned in my original message, "The app does support loading all the DLL's in a certain directory".
Thanks
Joe
|
|
|
|
|
i miss that. As you have the header file for the DLL export function prototype which going to load by the C app. So i guest developing the Dll with C/C++ is the choise. As VB can not create normal WIN32 DLL as the LoadLibrary API need a valid dll entry point which does not generated in VB ActiveX Dll.
K-PAX? CHANGE THE WAY YOU LOOK AT YOURSELF, OTHERS & THE WORLD...
|
|
|
|
|
here is the portion of source code to retrieve data from database
---------------------------
Dim dr as SQLDataReader
Dim cmd as SQLCommand
Dim cnn as SQLConnection
cnn=new SQLConnection(ConfigurationSettings.AppSettings("ConnectionString"))
cnn.open()
cmd=new SQLCommand(sqlstr,cnn)
dr=cmd.ExecuteReader()
do while dr.read()
hp=dr("handphone")
loop
dr.close()
---------------------------
i was wondering do i need to close the SQLConnection cnn ?or when i close SQLDataReader dr, cnn will automatically be closed?
thank you.
regards
yccheok
|
|
|
|
|
You should close the connection only after you are done with the data reader. Fortunately, there is a way to automatically close the connection when you close the data reader, that is by supplying the following argument in the ExecuteReader Function:-
cmd.ExecuteReader(CommandBehavior.CloseConnection)
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Here is what I hope will be a simple question. In the old VB6, we could use the app.path to get the application path. What do I used to do this in VB.NET?
|
|
|
|
|
Is this is what your looking for...
The following example gets this property and displays its value in a text box. The example assumes that textBox1 has been placed on a form.
Private Sub PrintStartupPath()<br />
textBox1.Text = "The path for the executable file that " & _<br />
"started the application is: " & _<br />
Application.StartupPath<br />
End Sub
|
|
|
|
|
Application.StartupPath only works in Vb6
In vb.net, you have 2 choices that work:
1) System.Reflection.Assembly.GetExecutingAssembly.Location
2) System.IO.Directory.GetCurrentFolder
I hope this helps
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
If Application.StartupPath is only applicable to VB6 then why did that sample come from the .Net Framework class library? I ask this question because I have just upgraded from Visual Studio 6 to Visual Studion .Net Pro and this sample came from the .Net help. Visual Studio 6 is now not installed.
Here is the complette sample...
.NET Framework Class Library
Application.StartupPath Property [Visual Basic]
Public Shared ReadOnly Property StartupPath As String
Property Value
The path for the executable file that started the application.
Example
[Visual Basic, C#] The following example gets this property and displays its value in a text box. The example assumes that textBox1 has been placed on a form.
Private Sub PrintStartupPath()<br />
textBox1.Text = "The path for the executable file that " & _<br />
"started the application is: " & _<br />
Application.StartupPath<br />
End Sub
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server family
.NET Framework Security:
FileIOPermission for reading and writing files. Associated enumeration: FileIOPermissionAccess.Read
See Also
Application Class | Application Members | System.Windows.Forms Namespace
|
|
|
|
|
I just tried it in VB.Net by the following:
TextBox1 = Application.StartupPath
Worked fine
|
|
|
|
|
BusterG wrote:
TextBox1 = Application.StartupPath
This is really weird coz Application.StartupPath doesn't work for me! Is there some other namespace or something that i'm suppose to add???
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
I didn't add any Imports to the code, just added a TextBox to the form and added TextBox1.Text = Application.StartupPath to the Form1_Load .
That should be all you need!
|
|
|
|
|
That's weird coz this doesn't work for me! The IDE doesn't even recognizes the Application keyword (i.e. there are squigly blue lines underneath the word saying it that 'Application' is not declared)
Does anyone know why this happens?
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
The VB.Net help file states:
Requirements
Namespace: System.Windows.Forms
I guess thats why it works without any other namespace declarations if you place the code in a form. So needless to say, if you declare Imports System.Windows.Forms it should work fine.
|
|
|
|
|
OMG!!!
This is really embarassing.It works now. It didn't work before coz i was testing the code in a class library project ( which doesn't include system.windows.forms). I can't believe I was so blind/stupid!!
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Does anyone know how to recieve a UDP packet without blocking. The udpClient appears to block. I was using the Winsock control in VB6 but have just upgraded to VB.NET.
|
|
|
|
|
HI!
Is there an free FTP class library for .NET available?
OR an open source project that write a FTP class?
gcio
|
|
|
|
|
Have you tried searching:
http://www.planetsourcecode.com
On first attempt I found this which might help:
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=341&lngWId=10
hth, Rohan.
|
|
|
|
|
I know that services and UI are No-No and Microsoft says that it is not recommended ( But their SQL server service does the same and so a lot of other third party services….Where can I find explanation for this).
I’m trying to display user interface from my VB.Net service. I can run my service under system account and check “allow to interact with desktop”, however my Form hangs. What are my options?
(1) Can I start another UI application from my service have them talk i.e. service can talk to application?
Thank you for helping me with this
Kasturi
|
|
|
|
|
hi,all
I write a COM Dll in Visual ATL . And I refer the COM dll in VB environment. The vb program runs well except when the program exit, the error dialog occur. The error info are such as "the address can't read ..." . Is it concerns with
the c++ pointer ??? But how can I find the actuall false??
Are there any tools to help to debug the com dll??
The problem disturb me for very long time .
Ask for your help , please !
Regards.
|
|
|
|
|
dear all,
i'm using listview control in vb6.
how do i deselect a listview item (report view with full row select) by clicking.
can somebody come to rescue?
rishabhs
|
|
|
|