Quantcast
Channel: CodeGuru Forums - Visual Basic 6.0 Programming
Viewing all 736 articles
Browse latest View live

Is there a faster way to Copy and Paste String to another program i.e. notepad?

$
0
0
Is there a way to be able to clipboard.gettext within a range using setcursor for immediate pasting rather than going from window to window. I'm using clipboard.settext then rightmouse+paste or ctrl+v to a notepad.:D

Compiler does not recognize the standard printer.Methods. gives error461

$
0
0
Trying to maintain an old program that has been running fine. All of a sudden, the compiler only recognizes these Print.methods:

CAPTION
CHECKED
ENABLED
INDX
TAG
PARENT
VISIBLE

It doesn't recognize the standard methods: CURRENTX, CURRENTY, PRINT, ETC

ComboBox inside MSHFlex Grid

$
0
0
Hello! This is my first post to the VB forum. I've tried to complete a task in VB 6.0 and for the time being, it works fine. What I am doing is to add ComboBoxes in each row of MSHFlex Grid (On thrid column of the grid) on run time and as the following:

Attachment 34813

This is how it looks like now. Secondly, the ComboBoxes are attached with the rows as follows whenever Add Customer button is clicked:

Attachment 34815

I am not sure what I am doing wrong or anything missed, this is what I've done so far:

Code:

Private Sub Form_Load()
SetupCombo

    With Combo2
        .Visible = True
        .AddItem "Denim"
        .AddItem "Pringles"
        .AddItem "Bounty"
    End With
   
    With MSHFlexGrid2
        For i = 0 To MSHFlexGrid2.Cols - 1
            .RowHeight(i) = Combo2.Height
        Next
    End With
End Sub

Private Sub btnAdd_Click()
 '**Bind ID and Name From The TextBoxes in The MSHFlex Grid - Starts**
    With MSHFlexGrid2
        MSHFlexGrid2.AddItem (txtID.Text) & vbTab & (txtName.Text)
    End With
'**Bind ID and Name From The TextBoxes in The MSHFlex Grid - Ends**

SetupCombo
End Sub

Private Sub MSHFlexGrid2_Click()
    If MSHFlexGrid2.Col < 1 Or MSHFlexGrid2.Row < 1 Then Exit Sub
    SetupCombo
End Sub

Private Sub SetupCombo()
'**Setting Up The ComboBox By Positioning and Sizing It Over The MSHFlex Grid Cell - Starts**
 
Dim posL As Single
Dim posT As Single
Dim posW As Single
Dim posH As Single
 
    With MSHFlexGrid2.Container
        posL = .ScaleX(MSHFlexGrid2.CellLeft, vbTwips, .ScaleMode)
        posT = .ScaleY(MSHFlexGrid2.CellTop, vbTwips, .ScaleMode)
        posW = .ScaleX(MSHFlexGrid2.CellWidth, vbTwips, .ScaleMode)
        posH = .ScaleY(MSHFlexGrid2.CellHeight, vbTwips, .ScaleMode)
    End With
 
    With Combo2
        .Move MSHFlexGrid2.Left + posL, MSHFlexGrid2.Top + posT, posW
        .Visible = True
        .SetFocus
    End With
   
'**Setting Up The ComboBox By Positioning and Sizing It Over The MSHFlex Grid Cell - Ends**
End Sub

This is my first VB project. I would expect some valuable ideas or suggestions from the expert to complete the above task or if there is any improvement required. Thanks.

Note: For the demo purpose, I am trying to achieve something like the below image using MSHFlex grid. If it couldn't be done, any alternate would be appreciated:

http://s16.postimg.org/iutl0z22d/out..._C5.gifhttp://

transparentblt() paint into picture box from a picture that is not visible

$
0
0
I have found some code to paint with transparency from a picturebox into another. The intent is to make a virtual volume control fader. The fader cap moves with mouse over. Problem is, that my source picturebox needs to be not visible on the screen. this code works when picture1 is visible Code: --------- TransparentBlt Picture2(i).hdc, 18, position(i), Picture1.ScaleWidth, Picture1.ScaleHeight, Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, vbRed --------- is there a way to substitute picture1 with a stdpicture object, or any other way besides Picture1 visible on the form? TIA for any help or suggestions Attachment 34825 (http://forums.codeguru.com/attachment.php?attachmentid=34825)

Method ~ of object ~ failed in vb6

$
0
0
When I run my program I got the following error, "Method ~ of object ~ failed" But when I debugged the code, I got the exact error, "Method name of object IWave failed" from the below code Public Function PlotWave(WaveIn As AlgsLib.IWave) As Boolean ..... WaveIn.name = DuplicateNameforUntitled ..... End Function I thought this is there is some problem with the method 'name'. Then I skipped this code and executed the remaining code. Then again different error came from the below code, "Method samplerate of object IWave failed" Private Function Plot(WaveIn As Waveform) As Boolean samplerate = WaveIn.DSPWave.samplerate Where DSPWave is, Public Property Get DSPWave() As IWave Set DSPWave = m_DSPWave End Property By looking all these, the problem should be with the interface IWave. But the reference to this dll is properly added. (Also if the problem is with reference, in compile time itself it should show up). How to get rid of this problem?

Or in Where Clause MS Access Vba Code

$
0
0
Can anyone help me in Where Clause? I have three fields Country,Product, and Year in Table Cap. I have added Combobox in form for these field and also search button. I want that if one combo box value is selected and search button is click it should display all record for related combo box. .... Button Click Code: Search = "Select * from Cap where ([Country]= '" & Me.Combo6 & "' OR [Product]= " & Me.Combo15 & " OR [Years]= " & Me.Combo25 & " )" Me.sfrmCap.Form.RecordSource = Search Me.sfrmCap.Form.Requery It gives Run time error 3075. Any help would be appreciated. Thank you.

Helpppppp

$
0
0
Im gcse level and need to make sure a user only types digits and it has to be exactly 8. Anyone got ideas???

Does a SetWindowText required to add a GetNextWindow?

$
0
0
:wave: Hi! I'm trying to create a form where i can add a string to another window, I would like to ask if GetNextWindow is necessary if your using SetWindowText and if hwnd is a property can I assign a coordinates? :wave:

Blinking Msflexgrids'cell depending on value

$
0
0
hallo everyone, I'am not a professional but i try get some cells of Msfexgrid bliking with red backcolor when for examples values in those cells are negative. can somebody help me? Best regards

Convert Double to Hex and back to Long in Chinese Unicode for VB6

$
0
0
I am fairly new to VB6 and I would like to convert a parameter from Double to Hex and back to Long for Chinese Unicode. The issue here is for input values from 1-127, the output is the same. For values beyond 127, the output is 63. The parameter is 4 bytes long. Here's a snippet of the 2 conversion functions I have used so far: DoubleToHex: Code: Code: --------- Public Function ConvDoubleToHexString(dVal As Double, ByVal nByteCount As Integer) As String Dim sHex As String Dim sTmp As String Dim n As Integer Dim m As Long Dim sRet As String Dim nByteCountMerk As Integer m=1 sHex = Hex(dVal) nByteCountMerk = nByteCount If nByteCount < Len(sHex) / 2 Then nByteCount = Len(sHex) / 2 If nByteCount < 1 Then nByteCount = 1 sHex = String(nByteCount * 2 - Len(sHex), "0") & sHex For n = 0 To nByteCount - 1 sTmp = ChrW(Val("&H" & Mid(sHex, m, 2))) m = m + 2 sRet = sRet & sTmp next n If Not bLH Then ConvDoubleToHexString = Right(sRet, nByteCountMerk) Else For n = Len(sRet) To 1 Step -1 sLH = sLH & Mid(sRet, n, 1) Next n ConvDoubleToHexString = Left(sLH, nByteCountMerk) End If End Function --------- HexToLong: Code: --------- Public Function ConvHexStringToLong(sHex As String) As Long Dim sHex As String Dim sTmp As String Dim n As Integer Dim m As Long Dim sRet As String Dim nByteCountMerk As Integer If sHex = "" Then ConvHexStringToLongAbs = knolong Exit Function End If For i = 1 To Len(sHex) If l >= 8388608 Then ConvHexStringToLongAbs = knolong Exit Function End If l = l * 256 * 2 l = l + Asc(Mid(sHex, i, 1)) Next ConvHexStringToLong = l End Function ---------

Permission Denied

$
0
0
I compile my VB6 project. If I do not delete .EXE the next time I try to compile and select replace existing I get an error "Permission Denied" with the title saying "Microsoft Visual Basic". Is it really VB? Or it is Windows? I did not have this problem within many years, then, I even do not remember when, I started to get this message. I usually delete the old EXE and compilation goes further. Recently I installed Visual Studio 2017. Every time I try to start the project for the second time after opening I get an error saying that exe cannot be replaced because it is used by another program. I started to suspect that somehow Windows doesn't release EXE file. And it happens with both VB6 and VB.Net. And if with VB6 it is not a big deal to delete EXE before new compilation and it allows to start the program without compilation, with .NET it is so unnoing to close the project and open again after smal change. Without restarting the project I have no way to start the project to test the changes I made. Again, who is this - Visual Studios (6 and 2017) or Windows? I'm using Windows 7. How to fix this problem? I tried Google with no success. Thank you

How to split data from 1 single text box to multple rows in mshflexgrid

$
0
0
Hi Can anyone tell me "How to split data from 1 single text box to multiple rows in mshflexgrid" eg: if I have 1 text box have quantity 1000 and I want to divide this quantity in 5 (5 X 200) and same quantity need to go in mshflexgrid's row and column through command button. like this.. Sr no Quantity 1 200 2 200 3 200 4 200 5 200 total 1000

Question about array memory

$
0
0
If I use Global VarCol(144000,450) as double, I will get no out of memory in VB6 Windows 10 But if I use Global VarCol(144000,500) as double, the out of memory pops up. It's only a array of 144001 x 501 x double = 577 MB and I have 32GB of memory, so I don't understand that there isn't room enough for this array. I understood I could use arrays up to 2Gb. Thanks in advance

decompiling windows apps.

$
0
0
Hi Guys, I'm new here, anyways I managed to decomplie a few of the programs down to machine language and found that getting it to high level language is a pain in the butt. Is there any better way to make it easier? im not sure if this is the right place to post this. if not please MOD help to move to correct locations. Thank You Snobje

VB is Crashed When Press Exit Button

$
0
0
In my VB project when i Press Exit Button, VB6 is Crashed Why Like this???

Save the webpage

$
0
0
Hello Please Help save page web Code: --------- Dim WithEvents Web As SHDocVw.InternetExplorer Private Sub Form_Load() Set Web = New SHDocVw.InternetExplorer Web.Visible = True Web.Navigate App.Path & "\index.htm" End Sub --------- Edit the example

Run Time Error:3709

$
0
0
Code: --------- Option Explicit Private Sub cmdClose_Click() Unload Me End Sub Private Sub cmdPrint_Click() modConnect.Connected Set Record = New ADODB.Recordset Record.Open "Select * from SalesInvoice where InvoiceNo = " '& txtInvNo.Text & ' " , Connect, 3, 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 .Show 1 Set Record = Nothing End With Exit Sub End If End Sub Private Sub Form_Load() modConnect.Connected Me.Top = (Screen.Height - Me.Height) / 2 Me.Left = (Screen.Width - Me.Width) / 2 End Sub --------- the connection cannot be used to perform this operation. it is either closed or invalid

[RESOLVED] Table is there but program cannot see it ???????

$
0
0
Code: --------- ImpTableName(0) = "Debtors" ImpTableName(1) = "Stock" ImpTableName(2) = "StatsWeek" ImpTableName(3) = "StatsMonth" ImpTableName(4) = "StatsDaily" ImpTableName(5) = "SpecialPrices" ImpTableName(6) = "StockGroups" ImpTableName(7) = "SalesTax" ImpTableName(8) = "DebtorMemos" ImpTableName(9) = "SUPPLIERSIN" <<<<<<<<<<<<<< cant find this one ImpTableName(10) = "DEBTORTRANSACTIONS" <<<<<<<<<<<<<< cant find this one ImpPathName(0) = "ITMDREX.CSV" ImpPathName(1) = "ITMSTEX.CSV" ImpPathName(2) = "ITMZSZW.CSV" ImpPathName(3) = "ITMZSZS.CSV" ImpPathName(4) = "ITMAREX.CSV" ImpPathName(5) = "ITMPRICE.CSV" ImpPathName(6) = "ITMGROUP.CSV" ImpPathName(7) = "ITMSTAX.CSV" ImpPathName(8) = "ITMDRMM.CSV" ImpPathName(9) = "ITMCRCR.CSV" ImpPathName(10) = "ITMDRDN.CSV" For ImpCnt = 0 To 1 ClearTable ImpTableName(ImpCnt) Next ImpCnt For ImpCnt = 5 To 10 ClearTable ImpTableName(ImpCnt) Next ImpCnt -------------------------------------------- Private Sub ClearTableOLD(TableName As String) Dim E As Long Dim ITMName As Database On Error GoTo ERR E = 1 Set ITMName = OpenDatabase(DatabaseImportPath) E = 2 StrSql = "Delete * From " & Trim(TableName) E = 3 ITMName.Execute StrSql E = 4 ITMName.Close E = 5 Exit Sub ERR: MsgBox "CANNOT CLEAR TABLE " & TableName & " " & "E= " & E MsgBox ERR.Number & " " & ERR.Description On Error Resume Next ITMName.Close End Sub --------- The above code works perfectly on MY Machine When I install it on another machine I keep getting Error 3078 on the indicated file names - Files Not Found All other file names have no problems being found - just the last 2 Other VB6 programs on the other machine can see both the files that this program is getting the error on Any Ideas please ???

Run Time Error:91

$
0
0
Code: --------- Private Sub stock() Set Record = New ADODB.Recordset Record.Open "Select * from Stockin where ProductCode='" & TxtDesc.Text & "'", Connect, 1, 3 With Record If .EOF = True And .BOF = True Then Else txtQty.Text = Record!Qty txtpack.Text = Record!Packing txtPrice.Text = Record!SalesPrice Record.Close Set Record = Nothing End If End With End Sub --------- Object variable or with block variable not set

Printing invoice in contiinous paper using USB Dot matrix printer

$
0
0
I wish to print Invoice in Continuous statonery (Roll Paper ) width of paper 4 inches My problem , after printing one bill printer skips and giving lot of space between two bills. (Paper ejected after printing Bill ). My Requirement is printer must stop printing after completing Invoice. ( no gaps required ) and user tear off that bill and continue to print next Invoice. I am Using TVS RP 45 shoppe (USB DOT Matrix Printer). NOTE: I am not interested in Text file Printing (Print #1 ) method. In this I cannot use different Fonts and font size. I wish to print shop name and address printed in Big font. Please help me MY Code is here Code: --------- Printer.Font = "Arial" Printer.FontBold = True Printer.FontSize = 12 Printer.CurrentX = 3400 Printer.CurrentY = 50 Printer.Print " XXXXXXXXXXXXXXXX " Printer.Font = "Arial" Printer.FontBold = False Printer.FontSize = 10 Printer.CurrentX = 3400 Printer.CurrentY = 350 Printer.Print " XXXXXXXXXXXXXXXXXXXXX " Printer.CurrentX = cx - TextWidth(custdue) printer.CurrentY = cy + 300 Printer.FontSize = 10 Printer.Print Format(custdue, "00.00") cy = cy + 600 Printer.Line (6000, cy)-(7800, cy) '-h line Printer.EndDoc ---------
Viewing all 736 articles
Browse latest View live