Advertisement

03.11.2003 at 07:07PM PST, ID: 20547208
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

Modify VB database with C++ dll. How to send / retrieve ?

Asked by sheila1978 in VB Database Programming

Tags: , , , ,

I created a dll (in c++) to modify a 2D array and return the modified 2D array. I have a database in VB with 200 records of 5 fields each. I want to use my dll to return certains fields into my VB application.

The dll function: int _stdcall pusingan1(float now1[200][5])
it returns: dahPasang[200][5];
dahPasang is declared as float
the .def file exports: pusingan1;

The dll file is successfully built:

pusingan1.dll - 0 error(s), 32 warning(s)

there are only 2 types of warnings ..

warning C4101: 'pasang1' : unreferenced local variable
warning C4244: '=' : conversion from 'float' to 'int', possible loss of data

the unreferenced local variables are for future use; the float -> integer conversion is for calculation purpose

In VB I use 2 forms : Form1 for the database & Form2 to display the required fields

I have declared the dll in both forms:

Private Declare Function pusingan1 Lib "C:\My Documents\vbPsm\pusingan1\Debug\pusingan1.dll" () As Variant

Then I want to give a variable name for my database using these steps:

Private Sub Command3_Click()
now1 = Data1.Recordset
Form1.Hide
Form2.Show
End Sub

In Form2 I  want to call the dll to modify my database but I'm not very familiar with VB.

If I use pusingan1(now1) .. error .. This program has performed an illegal operation
If I use now1.pusingan1 .. error .. run-time error '424': object required

****************************************************************************
Q1 : Please tell me how to call my dll / send my database to the dll.
****************************************************************************

So, I tried to just display a specific field from the database in the previous form using the command below:

Private Sub Command1_Click()
    Dim arrayKu As Variant
    Dim num1 As Integer

    arrayKu = now1
    num1 = arrayKu(0, 0)
    Text1.Text = num1
End Sub

The result when I press Command1 is:
run-time error '13': Type mismatch at num1 = arrayKu(0,0)

****************************************************************************
Q2 : Please tell me how to retrieve the field I want into a text box.
****************************************************************************

Start Free Trial
 
Loading Advertisement...
 
[+][-]03.12.2003 at 06:07AM PST, ID: 8119401

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: VB Database Programming
Tags: array, box, c, dll, vb
Sign Up Now!
Solution Provided By: cero
Participating Experts: 2
Solution Grade: B
 
 
[+][-]03.29.2003 at 04:21AM PST, ID: 8230202

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.29.2003 at 04:25AM PST, ID: 8230209

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.02.2003 at 11:28AM PST, ID: 8255976

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32