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

compiled code run slow

$
0
0
Hi,i am using windows 10 64 bit , my code load severl user control dynamically, when i test the program using visual basic 6 ide it is running fine, but when i compile and run the exe the same action take few seconds longer.
i run ander win xp compatible sp3 and as administrator .
any suggestions ?.
tx

How to Add data in datagrid using vb6 and access DB

$
0
0
Hi guys,

I am actually trying to find codes to add data in a datagrid on VB6 using Access. I have 2 forms that I created, one has the datagrid and the second has 2 textbox and the ADD button,I want data in the first form to be added to the datagrid in the second form, i am using ADO.

Please help guys????

Anomaly click in VB6

$
0
0
Hello everybody,

So, it's my first post in this furum, and I hope that I get a solution:

In fact, I have a probleme when I call a dll function and I see an anomaly:
- I puted a fuction under a button
- when I clkik on this button it seems that anithing does happen
- but when I was a little nurvous :) , I clicked 6 or 7 times on the same button and WOW, it return what I expect !!!
- it's repeatable and it's not acceptable for me :( and I wanna get the information from the first click

here is the code under button

CompleteSNR = getSerialNumberForAttrib(1, "STR1", "STR2", "STR3")
MsgBox (CompleteSNR)



and here is the declaration of this function :

Declare Function getSerialNumberForAttrib Lib "C:\EnvCIM\itacDllCVI.dll" (ByVal sessionID As Integer, ByVal stationNr As String, ByVal attributeCode As String, ByVal attributeValue As String) As String

and for informaion : the dll was developped under CVI labview

Thank you in advance

using inet to get html then populate it in webbrowser

$
0
0
i can get the source code of my website, i want to display the html source code on a webbrowser rather then the webbrowser loading up the page instead.

again how do i make the webbrowser display the source code just as you normally view it in text1 or notepad

form stretching pls

$
0
0
hi all

is there a code to make Form stretching On the Different screen resolution settings ؟؟

look attach photo

Regards
Attached Images
 

LIST ALL msCHART TYPE IN COMBOBOX VB6

$
0
0
Possible to list in combobox all tipe of MSchart?
tks.

Calling IsWindows10OrGreater from VB6 in Windows 10

$
0
0
Generally I use RtlGetVersion to check whether my VB6 app is running in Windows 10. But this time I wanted to know whether I can use IsWindows10OrGreater for this purpose and test this WinAPI function in various environments. Sadly enough, but I could not call it from VB6. My declarations like this

Code:

Private Declare Function IsWindows10OrGreater Lib "Kernel32" () As Boolean
simply gave me the run-time error 453 "Can't find DLL entry point". I tried it in the VB6 IDE and in the compiled exe - nothing helped.

Is it possible to call IsWindows10OrGreater from a VB6 app? Do we need to target our app for Win10 or do any other thing for that?

Connecting TreeView with Database

$
0
0
Hi Dears
I have a treeview project, I can add (Node)s at runtime but I want to connect treeview to a database to save nodes and retriever nodes. also I want to print the treeview as a content map.
Please help me!

keyboard control

$
0
0
Hi guys,
Im beginner to vb6. I know to control the key press events within a textbox, rtb etc and that works fine within vb6 project.
My query is that how can we control/change the keypress events outside the vb like in word, notepad, wordpad etc.

Thanks in advance.

Https login example working

$
0
0
am looking for https examples, most of the ones i found are out dated and dont work no more.
if u can share working example of todays https login will appreciate.

I can't click Webbrowser's Element

$
0
0
I want to click one <div> but I couldn't click it with my standart code. You need to press F12 and select mobile emulator to see this mobile version of website. After then you can click button manually but you can't click it programmatically. I can't use API so I need to do it with web elements. Please help...

This is my standart code;
Code:

For Each obj1 In WebBrowser1.Document.GetElementsByTagName("div")
            If (obj1.GetAttribute("class") = "_o5rm6 coreSpriteCameraInactive") Then
                obj1.Click: Exit For
            End If
            Next

This is the button where I want to click;
Name:  Adsız.png
Views: 68
Size:  25.5 KB

This site is instagram... Help me...
Attached Images
 

Serial number in Data Report is not starting from 1,2...

$
0
0
Code:

Private Sub cmdPrint_Click()
Set Record = New ADODB.Recordset
Record.Open "SELECT InvoiceNo,Qty,Price,TotalAmount,DateCreated,CustomerName,ProductCode,ContactNo,Address,City,Tin,Dist,Packing,(SELECT COUNT(*) FROM SalesInvoice C2 WHERE C2.ProductCode <= C.ProductCode) AS SerNo FROM SalesInvoice C where InvoiceNo = '" & txtInvNo.Text & "' ORDER BY ProductCode asc ", Connect, 1, 3
    If Record.RecordCount > 0 Then

        With rptSalesInvoice
            Set rptSalesInvoice.DataSource = Record
                .Sections("Section4").Controls("Label17").Caption = Record!DateCreated
                .Sections("Section4").Controls("Label18").Caption = Record!InvoiceNo
                .Sections("Section4").Controls("Label19").Caption = Record!CustomerName
                .Sections("Section4").Controls("Label28").Caption = Record!Address
                .Sections("Section4").Controls("Label29").Caption = Record!City
                .Sections("Section4").Controls("Label31").Caption = Record!ContactNo
                .Sections("Section4").Controls("Label33").Caption = Record!Tin
                .Sections("Section4").Controls("Label34").Caption = Record!Dist
                .Show 1
            Set Record = Nothing
        End With
        Exit Sub
    End If

End Sub

Serial number in Data Report is not starting from 1,2...?

Releasing Excel after creating spreadsheet at code

$
0
0
I'm creating a spreadsheet but have a slight issue. The spreadsheet seems to stay in the system memory after it's been create whether excel is open or not and so it cannot be deleted unless you go into the task manager in windows and end the excel process manually. This only seems to be intermittent. I can run x amounts of spreadsheet fine and then one will stick in the system memory. Has anyone come across this or know a solution.

Below is the code i'm using to open and close the workbook.

Code:


Public MyXL As Excel.Application 
Public MyBook As Excel.Workbook

' opens the newly created spreadsheet ready to add data
Set MyXL = New Excel.Application
Set MyBook = MyXL.Workbooks.Open(gstrSpreadSheetName)


'CODE TO CREATE SPREADSHEET HERE


' closes created spreadsheet
MyBook.Close SaveChanges:=True
Set MyBook = Nothing
MyXL.Quit
Set MyXL = Nothing

Linear Algebra Problem: Solving for Euler between two ordered bases

$
0
0
Anyone here have some background in linear algebra?

I've got a problem I need to solve, and I need it in VB6, but I can't even find a clean solution in any language.

Let me see if I can outline the problem somewhat clearly. Okay, all of this will be in 3D space. In this space, we can define some origin. Typically, in my situation, this will be a point on the floor in the middle of some room. Next, we need to define X+, Y+, and Z+ in the room. Think of the X+ and Y+ as a piece of graph-paper lying on the floor with its origin on the room's origin. The Z+ is simply the third (UP) dimension.

Okay, with this information, we can define any other point in the room, even points that aren't on the floor. They'll just have a Z+ value other than zero. So, to represent any arbitrary point in the room, we might have the following UDT:

Code:


Public Type VectorType
    ' A 3D coordinate (point) somewhere in space with some pre-defined origin and axis basis.
    ' Typical units are mm.
    xPos As Double          ' Some X position in space relative to some origin.
    yPos As Double          ' Some Y position in space relative to some origin.
    zPos As Double          ' Some Z position in space relative to some origin.
End Type

Now, that room origin and axis system is often called an "ordered basis", or just a "basis".

I should briefly talk about something else too, the right-hand-rule. Basically, this states that, while you're looking down any axis at the origin, counter-clockwise rotations are positive, and clockwise rotations are negative. It's easy to visualize this as a piece of graph paper. You don't often think about it, but you're looking down the Z-axis when you're looking at graph paper. Rotations around this Z-axis around the origin are positive if they're counter-clockwise, rotating toward Y+ off of the X+ axis, which typically shoots off to the right. If we extrapolate this to 3-axes (3D), this is the right-hand-rule. Here's an image I once made trying to illustrate this:

Name:  Right Hand Rule.png
Views: 37
Size:  40.2 KB

Okay, forging on. Again, we've defined a "basis" (origin, X+ direction, Y+ direction, and Z+ direction) for our room. However, in truth, we can define any basis we like, so long as it's got an origin, an X+ direction, a Y+ direction, and a Z+ direction. Also, as another FYI, these three directions are required to be orthogonal.

Since we can actually define any basis we like, we have the following UDT:

Code:


Public Type BasisType
    ' To be correct, the line segments o-x, o-y, & o-z must be orthogonal.
    ' Right-hand-rule is assumed.
    oVec As VectorType    ' The origin of the basis, a vector.
    xVec As VectorType    ' X direction of basis, a vector, ideally one unit away from o.
    yVec As VectorType    ' Y direction of basis, a vector, ideally one unit away from o.
    zVec As VectorType    ' Z direction of basis, a vector, ideally one unit away from o.
End Type

The origin (oVec) will always be in reference to our room's basis. However, the other three vectors can be rotated such that they're not parallel to the room's axes (X+, Y+, Z+).

Ok, one last piece of groundwork. To rotate from one basis to another, we can have what we call Euler angles. Their UDT would look something like the following:

Code:


Public EulerAnglesType
    ' Preferrably, these will be in degrees (but VB6 prefers radians for trig functions).
    xRot As Double
    yRot As Double
    zRot As Double
End Type

Ok, we can also talk about a translation (movement of the origin), but I'm mostly concerned about the rotation, so let's just forget changes in the origin of our two bases.

(Also, some might be having visions of quaternions and/or transformation matrices, but let's set those aside for now too.)

Ideally, what I'd like is code that solves for the Euler angles that would rotate one basis to another basis. In other words, given two bases (defined with the above BasisType UDT), how would I solve for the Euler angles (defined with the above, EulerAnglesType)?

I'll be quite interested in the replies.

Thanks,
Elroy

EDIT1: Ohhh, and the solution must follow the right-hand-rule.
Attached Images
 

Help, webbrowser result in a label or textbox (refresh)

$
0
0
Good afternoon, thank you in advance for any help.
I have the code listed below running almost perfectly, the only thing I'm not getting is in the case of "updating" the label with the contents of the webbrowser. Ie when I run the form it already starts taking the contents of the webbrowser and plays on the label, but when it refresh the browser it does not update the label. I hope that I have been able to explain, once again thank you very much for the attention and help that you can give

Code:

Public Class Form1

 

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        WebBrowser1.Refresh()

    End Sub

    Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        Me.WebBrowser1.Navigate("url ")

        Try
            If Not IsNothing(WebBrowser1.Document) Then
                Dim elementos = WebBrowser1.Document.GetElementsByTagName("span")
                If (Not IsNothing(elementos) And elementos.Count > 0) Then
                    Dim i As Integer = 0
                    While (i < elementos.Count AndAlso Not elementos.Item(i).OuterHtml().Contains("texto_musica"))
                        i += 1
                    End While
                    If (i < elementos.Count) Then
                        resultado = elementos.Item(i).InnerText
                        Label1.Text = resultado
                    End If
                End If
            End If

        Catch ex As Exception

        End Try

        Timer1.Enabled = True
        Timer1.Interval = 3000
        Timer1.Start()

    End Sub

    Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click


    End Sub

    Dim resultado As String

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

       
    End Sub

End Class


MUTEX_NAME for VB6 App

$
0
0
Hi there,
A VB6 app has a static mutex name by default, but checking through the Process Explorer using this advice there are a number of them:

Quote:

Mutant \Sessions\1\BaseNamedObjects\MSCTF.Asm.MutexDefault1
Mutant \BaseNamedObjects\20b70e57-1c2e-4de9-99e5-20f3961e6912
Mutant \Sessions\1\BaseNamedObjects\MidiMapper_modLongMessage_RefCnt
Mutant \Sessions\1\BaseNamedObjects\SessionImmersiveColorMutex
Mutant \Sessions\1\BaseNamedObjects\SM0:8240:64:WilError_01
Plus more.
Suspect it's the second one with the GUID, but is the actual mutex name required for Inno just the GUID or do we include "\BaseNamedObjects\" as well.
Edit: Oops! Already defined it in the code!
Code:

Const MUTEX_NAME As String = "Global\20b70e57-1c2e-4de9-99e5-20f3961e6912" '20b70e57-1c2e-4de9-99e5-20f3961e6812'
So when checking for AppPrevInstance it's already set for the application.
Inno suggests creating a custom mutex name- but is that absolutely necessary - or even practical?
Thanks for reading.

[RESOLVED] Releasing Excel after creating spreadsheet at code

$
0
0
I'm creating a spreadsheet but have a slight issue. The spreadsheet seems to stay in the system memory after it's been create whether excel is open or not and so it cannot be deleted unless you go into the task manager in windows and end the excel process manually. This only seems to be intermittent. I can run x amounts of spreadsheet fine and then one will stick in the system memory. Has anyone come across this or know a solution.

Below is the code i'm using to open and close the workbook.

Code:


Public MyXL As Excel.Application 
Public MyBook As Excel.Workbook

' opens the newly created spreadsheet ready to add data
Set MyXL = New Excel.Application
Set MyBook = MyXL.Workbooks.Open(gstrSpreadSheetName)


'CODE TO CREATE SPREADSHEET HERE


' closes created spreadsheet
MyBook.Close SaveChanges:=True
Set MyBook = Nothing
MyXL.Quit
Set MyXL = Nothing

[RESOLVED] MUTEX_NAME for VB6 App

$
0
0
Hi there,
A VB6 app has a static mutex name by default, but checking through the Process Explorer using this advice there are a number of them:

Quote:

Mutant \Sessions\1\BaseNamedObjects\MSCTF.Asm.MutexDefault1
Mutant \BaseNamedObjects\20b70e57-1c2e-4de9-99e5-20f3961e6912
Mutant \Sessions\1\BaseNamedObjects\MidiMapper_modLongMessage_RefCnt
Mutant \Sessions\1\BaseNamedObjects\SessionImmersiveColorMutex
Mutant \Sessions\1\BaseNamedObjects\SM0:8240:64:WilError_01
Plus more.
Suspect it's the second one with the GUID, but is the actual mutex name required for Inno just the GUID or do we include "\BaseNamedObjects\" as well.
Edit: Oops! Already defined it in the code!
Code:

Const MUTEX_NAME As String = "Global\20b70e57-1c2e-4de9-99e5-20f3961e6912" '20b70e57-1c2e-4de9-99e5-20f3961e6812'
So when checking for AppPrevInstance it's already set for the application.
Inno suggests creating a custom mutex name- but is that absolutely necessary - or even practical?
In any case the application is detected using the second GUID (ending 812) and terminated by Inno.
Thanks for reading.

Help translating qbasic code to VB6

$
0
0
Hi,

I'm trying to convert this piece of code made in qbasic to vb6:

Code:

1240 DEFINT I-N
1250 DEFDBL A-H,P-Z
1290 DIM POL(7,3),RES(3)
1300 DIM SL(50),SR(50),SA(50),SB(50),CL(184),AL(184),BL(184)
1310 OPEN "DATA1" AS #2 LEN=96
1320 FIELD 2, 4 AS NN$, 4 AS DEB$, 4 AS FIN$, 84 AS POL$
5560 GET #2,3 'or register 4, 34, 5678...etc
5570 K=1
5580 FOR J=1 TO 3
5590  FOR I=1 TO 7
5600    POL(I,J)=CVS(MID$(POL$,K,4))
5610    K=K+4
5620 NEXT I,J

My problem is the output of NN,DEB and POL(2,3) - for instance. I can't get right the format numbers.

NN, gets an integer which is correct. But all the others are wrong. I think there's a bit order correction to make. I'll have several other files of this type to convert, but different.

Can someone help?

Kind regards,

JKepler

HttpWebRequest login example vbforums

$
0
0
new to HttpWebRequest , i am fimiliare with winsock , so i will appreciate it if u can show me login to vbforums login example using HttpWebRequest thanks.
Viewing all 22096 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>