Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all 21349 articles
Browse latest View live

problems with external lib calls

$
0
0
First problem

With a c function definition
//////////////////////////////
#define VERSION "1.0.0"

__declspec(dllexport) const char* __stdcall GetVersion()
{
return VERSION;
}
/////////////////////////////

why a vb6 declaration like

Public Declare Function GetVersion Lib "mylib.dll" () As String

just crash?


Others functions work fine



************************************************************************************

Second problem


This same library if i use it from the VB6 IDE it works perfectly ( except for the above function ) but if i build the exe file it crash, i modified the optimizations in the compiler options and after setting the "No optimizations" option the exe file didnt crash, but now it doesnt load ACTIVEXs files which are not registered with regedit, before with just copying the activex in the same folder as the exe file it had worked fine.

Weirder yet

i do the dll callings inside a class that is inside another class, but if a do the callings from the parent class it works fine, something like this pseudocode


Declare LibDoSomething lib .........................


class class2
{

sub DoSomething ()
call LibDoSomething()
end sub

}



class class1
{

sub Something()
set c2 = new class2
call c2.DoSomething ''''''''''''''' Crash , in exe file not in IDE
call LibDoSomething '''''''''' Not crash in exe file nor in IDE
end sub

}


call Something




somebody has any idea where can be the problem?

Thanks

Export Report in PDF from VB 6.0

$
0
0
Hello, I try to export my DataReport1 to PDF from ReportViewer in vb 6.0, I want to export with out showing report, how can i do export in pdf from my Form, because i'm new in Visual Basic, Pleas Help me.

Thank You.

Calling Microsoft Ace Database Engine V12 or V14 to open an Excel XLSX or XLS file

$
0
0
I am writing, as part of my app, functionality to open XLS /XLSX files in VB 6. I am using MS ACE Database engine. I have tried both ACE DB engine 12 and 14 on different PCs. I downloaded the installer from here: http://www.microsoft.com/en-us/download/details.aspx?id=13255

In my VB6 project, I tried but can't seem to set a reference to ACEOLEB.dll as this COM object can't be referenced - I get an error (and don't know what this error is : "UNEXPECTED ERROR OCCURRED IN GOFNF. ERROR IN LOADING DLL.". Furthermore, I tried registering the DLL and it does not succeed as this DLL can't be registered. However when I run my application and pick an XLSX file (or even an XLS file) I write the connection string as follows:

Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=C:\DB solution\EmailAssignments.XLSX;Extended Properties=\"Excel 12.0 xML;HDR=YES\";

When I try to CONNECT, I get an error:

ERRORCODE DB1004
Error -2147467259 : Could not find installable ISAM


Finally I searched Google for this type of error, and found this article on Microsoft support forum : http://support.microsoft.com/kb/283881 , which talks of the DLL MSEXCL40.DLL possibly missing or not registered; but this file applies to Office 2003. My Users will be using Office 2007 or 2010 and my application is in VB6 - all of which doesn't seem to be compatible and I can't seem to open ANY Excel files.

Can anyone help me (if this ACE DB engine works with VB6)? or can someone suggest how I could find the appropriate XLSX driver in a user system and write a DSN "on the fly" once they picked the XLSX file to use?

I would really appreciate your help. Many Thanks in advance.

Regards
Mark

Special Characters In TextBox!

$
0
0
Hello Guys ...

I have a TextBox which must contain special Characters (anything except Alphabets and Digits). How can i write such a code to do so ?!

Something like this :

If 'Text1.Text has any alphabet or digits then
MSGBOX "alphabet or digit found"
end if

Thanks in advance ...

[RESOLVED] Calling Microsoft Ace Database Engine V12 or V14 to open an Excel XLSX or XLS file

$
0
0
I am writing, as part of my app, functionality to open XLS /XLSX files in VB 6. I am using MS ACE Database engine. I have tried both ACE DB engine 12 and 14 on different PCs. I downloaded the installer from here: http://www.microsoft.com/en-us/download/details.aspx?id=13255

In my VB6 project, I tried but can't seem to set a reference to ACEOLEB.dll as this COM object can't be referenced - I get an error (and don't know what this error is : "UNEXPECTED ERROR OCCURRED IN GOFNF. ERROR IN LOADING DLL.". Furthermore, I tried registering the DLL and it does not succeed as this DLL can't be registered. However when I run my application and pick an XLSX file (or even an XLS file) I write the connection string as follows:

Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=C:\DB solution\EmailAssignments.XLSX;Extended Properties=\"Excel 12.0 xML;HDR=YES\";

When I try to CONNECT, I get an error:

ERRORCODE DB1004
Error -2147467259 : Could not find installable ISAM


Finally I searched Google for this type of error, and found this article on Microsoft support forum : http://support.microsoft.com/kb/283881 , which talks of the DLL MSEXCL40.DLL possibly missing or not registered; but this file applies to Office 2003. My Users will be using Office 2007 or 2010 and my application is in VB6 - all of which doesn't seem to be compatible and I can't seem to open ANY Excel files.

Can anyone help me (if this ACE DB engine works with VB6)? or can someone suggest how I could find the appropriate XLSX driver in a user system and write a DSN "on the fly" once they picked the XLSX file to use?

I would really appreciate your help. Many Thanks in advance.

Regards
Mark

[RESOLVED] Special Characters In TextBox!

$
0
0
Hello Guys ...

I have a TextBox which must contain special Characters (anything except Alphabets and Digits). How can i write such a code to do so ?!

Something like this :

If 'Text1.Text has any alphabet or digits then
MSGBOX "alphabet or digit found"
end if

Thanks in advance ...

[RESOLVED] never seen this error before Error Extra in query Expression

$
0
0
i am trying to excute a query and i get this error 'Error Extra in query Expression'
first time i run in to this
what is wrong?
Code:

  Dim RsB As New ADODB.Recordset
 RsB.Open "Select Customers.Cellular ,Event.* from Event inner join Customers on Event.Subject = Customers.FullName " & _
"where EventTreatment <> 'OK'  AND SmsPermision  <> 'no'  AND LEN(Cellular) < 10 AND NOT left(Cellular, 2)) = '05'", CN

tnx for any help
regards salsa 31

[RESOLVED] Strange Behaviour in Format function while using Hex function in VB4

$
0
0
Can someone explain why the Format function refuses to put leading zeros in front of the hexadecimal numbers A thru F in this code? :)


Code:

For idx = 1 To 15      ' actually need to loop to 1024
        TxtStr = Format(Hex(idx), "000")
    Next

Is there a way to code this that will force the 'zeros' in front of the Hex number?

close msg dialog in webbrowser

$
0
0
i wana auto close msg in webbrower i get when i run my form
so here my code:
Private Sub wb1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
On Error Resume Next
SendKeys "{ESC}" ' or {ENTER}

but its not working...
help

mysql backup

$
0
0
I tried to use the command shell "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqldump -u root -passyla --databases db1 db2 db2 > d:\all_databases.sql",vbnormalfocus on vb6 code to make a backup application but it only runs the command on the command prompt but not export to sql backup file.

What is the right way to code it to export to sql backup file?

Is it possible to embed a sound clipping in a form?

$
0
0
I have been tinkering with the idea of developing a pronunciation guide for a certain class of words using Visual Basic 6.0. This project is still at a very early stage of conceptualisation, and as a part of analysing its feasibility, I'd like to know if VB offers an object that can play short sound clippings from a reservoir of recordings.

Please give me your suggestions on how this can be done.

Thank you.

virtual printer Thermal Printer Help

$
0
0
I'm debugging some code that writes directly to a usb port in order to print receipts on a receipt printer.
i actualy dont have a Thermal Printer to test this code
is there a way to test and print this without a Thermal Printer?
something like virtual Thermal Printer

any help will be appreciated
regards salsa31

want to know user agent when using VB6 webbrowser Control

$
0
0
I want to use web browser control in a vb6 application. My question is how requesting server will understand all request from this control? As internet explorer?

means, is there a way for website to now that this website is being access by webbrowser control and not by a proper browser like firefox or chrome.

Entering Query results from Access into a Datagrid (VB6)?

$
0
0
Alright folks, I'm currently creating a system for my computing A level course, I'm a novice coder and I need some help (due a tutors illness I'm completely in the dark) with copying the results from a query in Microsoft Access, into a Datagrid?

I've done some digging and asked some other tutors who mentioned something to do with flexgrids, but I'm still unsure of what to do with these and they have little experience with them too.

All I need is a method of copying the results from a query into a grid.

Any help is massively appreciated as multiple students would gain benefit from this.

Ignore locked files or invalid permissions when searching for string in files

$
0
0
VBScript 5.8 on Windows 2008 Server.

I copied some code from another source to look for certain strings in files, and whilst this code works, I wanted to open it up to search for all files within a given drive/directory.

This is the code that worked:

Code:

Dim FSO

Const START_DIR = "c:\"
Set FSO = CreateObject("Scripting.FileSystemObject")

set outFile = FSO.createTextFile( "c:\temp\findings.txt")

doFolder START_DIR

outFile.close



sub doFolder(path)
  ' WScript.echo "Doing folder " + path

  Dim folder, files, file, subfolders,subfolder

  set folder = FSO.getFolder(path)
  set files = folder.Files
  for each file in files
    doFile path, file.path
  next

  set subFolders = folder.subFolders
  For Each subfolder in subFolders
    doFolder subfolder.path
  Next

end sub

sub doFile( parent, path )
  ' WScript.echo "Found file " + path
  if right(lcase(path),4) = ".txt" then
    checklog parent, path
  end if
end sub

sub checklog(parent, path)
  ' Wscript.echo "log file " + path
  Set fl = FSO.opentextfile(path, 1)

  Do While fl.AtEndOfStream <> True
    line = fl.ReadLine
    if InStr(line, "searchstringhere" ) > 0 then
        output path
        Exit Do
    end if
  Loop
  fl.close
 
end sub

sub output(path)
  outFile.writeLine(path)
end sub

I edited the code to open up the search to check for all files:

Code:

sub doFile( parent, path )
  ' WScript.echo "Found file " + path
  ' if right(lcase(path),4) = ".txt" then
    checklog parent, path
  ' end if
end sub

Although this works to a point (until it errors on a file), it eventually bombs on file permissions errors and "Process cannot access a file because it is being used by another process" error for files such as .lck files.

Can anyone tell me how to code in an ignore/skip rule into this please?

Never touched VB before today, so be gentle!

Thanks in advance.

Copying records from one table to another in MS Access using a dataenvironment

$
0
0
Hi,

I'm currently working on a VB6 project in which I'm designing a booking system for my place of work (for a piece of Computing coursework (A Level)), one of the features is that any bookings older than one day are moved from my bookings table in MS Access to a table called ArchiveBookings.

In each form on my VB6 project I have datagrids showing the records that sit in each table.

The idea is that the records that have a DateOfBooking that it less than today's date is moved from the Bookings table to the ArchiveBookings table after a button is clicked and I just can't seem to figure it out after weeks of trying.

I'm not an expert programmer and to top it all off my tutor has fallen ill and the tutor who has taken over has no idea how to program in VB6. Unfortunately because nothing I've tried works I have no code to post.

Any help would be greatly appreciated and as I have seen in other threads the "I'm not doing your homework for you" is not appreciated.

Please help out a student in need, it would benefit others in my class too.

This is my last resort before I take it out of my program.

Thanks.

Load control from array of controls

$
0
0
this is my code

Code:

Function GenerateInterface()
Dim ObjectsArray() As VB.Control
Dim TmpCtrl As VB.Control

ReDim ObjectsArray(1)
For Each TmpCtrl In Me.Controls
    If TmpCtrl.Container Is frConfigVars(0) Then
        Set ObjectsArray(UBound(ObjectsArray) - 1) = TmpCtrl
        ReDim Preserve ObjectsArray(UBound(ObjectsArray) + 1)
    End If
Next TmpCtrl

For i = 1 To UBound(Variables) - 1 'global array containing how many frames I need
    Load frConfigVars(i)
    frConfigVars(i).Left = 0
    frConfigVars(i).top = frConfigVars(i - 1).top + frConfigVars(i - 1).Height
    frConfigVars(i).Visible = True

    For x = 0 To UBound(ObjectsArray) - 1
        Set TmpCtrl = ObjectsArray(x)
        Load TmpCtrl(i) '<-- crashes here
        'stuff to move and view new object
    Next x
Next i

End Function

It basically loads into a controls array the 0-indexed objects present in the frame to make me dinamycally load them how many times I need but I can't manage to load a new control from a variable itself.

I kinda got why that loading is crashing, I'm guessing the TmpCtrl contains (example) txtbox(0) and not txtbox, which I'd need to load the new object, correct? If so, how can I load the new control?

I can't create objects from scratch because there are many of them and positioning would be hell I can't call them by their name because with time I will add/remove some stuff so I don't want to touch this function again once it works

Thanks

VB6=>VBA OR VB.Net =>VBA -> Which one best ?? Why COM still exits??

$
0
0
Understanding VBA after learning VB6 bit of easier than after VB.Net or C#.


I just like put observation that despite of new technology why Microsoft was unable to remove COM in Office application???if it so than why Microsoft said VB6 dead??

members can put their view on my points >>>???

Right Mouse Click in TextBox brings up strange menu

$
0
0
I'm using the Right Mouse click to launch a popup menu, but when I Right Mouse click in the TextBox, a menu appears:

Undo (Grayed)
Cut (Grayed)
Copy (Grayed)
Paste
Delete (Grayed)
Select All
Right to left Reading order
Show Unicode control characters (Grayed)
Insert Unicode control character> (Grayed)
Open IME
Reconversion (Grayed)

After hitting the Esc key, then my popup menu appears.
I have no idea where this is coming from or how to stop it.

Any ideas?

[RESOLVED] virtual printer Thermal Printer Help

$
0
0
I'm debugging some code that writes directly to a usb port in order to print receipts on a receipt printer.
i actualy dont have a Thermal Printer to test this code
is there a way to test and print this without a Thermal Printer?
something like virtual Thermal Printer

any help will be appreciated
regards salsa31
Viewing all 21349 articles
Browse latest View live