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

Not Searching

$
0
0
Hi

Dim strsearch, strsql As String
strsearch = InputBox("Search For", "Search Input Box")
strsql = "SELECT * FROM m_itemmaster WHERE icode LIKE " & Chr(34) & strsearch & Chr(34)
Openrstitem (strsql)

Secondly i want if user enters * in inputbox it fills listview with all records , no filter.

What value i enter it does not search where as record exists

Thanks

Listview Selected Row

$
0
0
Is it possible to lock particular row in a listview or cannot be selected again when doubleClick?

Run Time Error 5 (Invalid procedure column or argument

$
0
0
Hi

When i move from 7 column to another column it gives this error

Private Sub flxgd_EnterCell()
With flxgd
Select Case .Col
Case 4
msgtxt.Enabled = True
msgtxt.Visible = True
msgtxt.SetFocus
msgtxt.Move flxgd.Left + flxgd.CellLeft, flxgd.Top + flxgd.CellTop, flxgd.CellWidth, flxgd.CellHeight
msgtxt.Text = .Text
Case 7 To (flxgd.Cols - 1)
msgtxt.Enabled = True
msgtxt.Visible = True
msgtxt.SetFocus
msgtxt.Move flxgd.Left + flxgd.CellLeft, flxgd.Top + flxgd.CellTop, flxgd.CellWidth, flxgd.CellHeight
msgtxt.Text = .Text
End Select
End With
End Sub

Thanks

Remove quotation marks

$
0
0
I'm opening a csv file and I'm trying to check for quotation marks within the string so that I can remove them.

For example in the following "Trial "A" 123" I want to get it so that it's "Trial A 123"

I thought I could analyze each individual character (and if a character was a quotation mark then I was going to remove it.) But that's no good because VB identifies the 2nd quotation mark as the end of the string. In other words, all I get when I input the string is "Trial "

So what can I do to solve this problem? Thanks.

How to have a vb6 executable append itself to another exe? Both still working?

$
0
0
Hello all. Is there a way to have an exe, made in vb6, append itself to another exe and having the resulting executable run both the original exes like you do with binders?
I don't mean put a resource file inside the application, extract it and run it.
I mean my exe will find the other exe's in the folder and append to them, still preserving the functionality of both.
I have seen some code like this:


Open "c:\File.exe" For Binary Access Read Write as 1#
Seek #1, Lof(#1)
Put #1,,YourData
....

but I don't know if this is correct and if the resulting file will execute both the original ones.
Thank you in advance.

Filter Like

$
0
0
Hi
I just cannot find why this skips a record can you help please
Info:- ADO connection to 2 Datagrid's col(0) contains surnames
in both grids and there are duplicates I want to find the first entry
in grid1 then the matching surname in grid2 and then to match col(1)
in grid1 to col(1) grid2 col(1) contains firstnames. extract info
from other col's
So find first surname that matches mySearch and in my test there
are 2 say Smith A and Smith B
But my code finds Smith B and not Smith A
Code:

VB6
'Match names
    mySearch = txtsName
    With frmTopMain
        .adoPhone.Recordset.MoveFirst
        Do While Not .adoPhone.Recordset.EOF
            myFilter = .dgPhone.Columns(0) Like mySearch
              If myFilter = True Then
                strName = .dgPhone.Columns(1)
                  Do While .dgPhone.Columns(0) Like mySearch
                    If strName = .dgdControl.Columns(1) Then
                        lblPhone(0) = .dgPhone.Columns(2)
                        txtPhone(0) = .dgPhone.Columns(3)
                        Exit Do
                    Else
                        .adoPhone.Recordset.MoveNext
                    End If
                  Loop
              Else
                .adoPhone.Recordset.MoveNext
              End If
              If myFilter = True Then Exit Do
        Loop
    End With

I find the correct record in the first grid by using movenext.

If Else not working

$
0
0
I can't seem to get my else statement to work. Basically if the value of cellRef is Null i want a pop up message, any suggestions why this is not working? Many Thanks in advance!

Code:

Private Sub displaybtn_Click()
 
Dim ni_num As String
Dim ni_num_missing_one As String

 
ni_num = TextBox1.Value & TextBox2.Value & TextBox3.Value & TextBox4.Value & TextBox5.Value
ni_num_missing_one = TextBox1.Value & TextBox2.Value & TextBox3.Value & TextBox4.Value & " "
 
cellRef = Cells.Find(ni_num, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Address

    If IsNull(cellRef) Then

        cellRef = Cells.Find(ni_num_missing_one, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Address

    End If


    If Not IsNull(cellRef) Then

        Range(cellRef).Activate
        Me.Resultbox = ActiveCell.Offset(0, -1).Value

  Else

        MsgBox "Not Found"


    End If

HTML Help Workshop Tutorial

$
0
0
Hi guys.

I've done a search but nothing useful shows up.

For many years I've been compiling the old Windows help files *.hlp for my apps and they have always worked perfectly. Vista, Windows 7, Windows Server 2008/R2 don't use Winhlp32.exe but you can download it from http://support.microsoft.com/kb/917607. Now this is strange because the API call says:

Public Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal dwData As Long) As Long

which I assume it uses user32.dll a standard Windows dll so why does Winhlp32.exe have to be present?

I downloaded HTML Help Workshop a long time ago but its not straight forward to use. I've Googled for tutorials but I haven't found anything that is much use.

Creating and Compiling an HTML Help File Project With HTML Help Workshop

How to easily benefit from Microsoft HTML Help Workshop

Introduction to Microsoft Help Workshop 4.0

Does anyone use HTML Help Workshop or any other free chm compiler or know of any good tutorials?

Cheers guys.

Problem: Looping inputted data

$
0
0
The cost is already saved and is displayed in a text box when you click on the item in the list. The customer inputs the quantity and that is then multiplied by the cost to give the total. However, I would like the total cost to keep going up until the customer has finished inputting the data. Any suggestions?

Capture an Image and load in the form.

$
0
0
Respected Sir,

I have made the code for capturing of Image and saving but i am unable to load on the form.

I want to load that capture image in the form.

Its an project of COLLEGE ADMISSION PROCESS in which i want to click the image from webcam and save on the COLLEGE FORM .

Adding a folder name to an app path.

$
0
0
Hi there and good day to you all. I have a student attendance program that will pop up a happy birthday message when they sign in on their birthday. The problem is the older version had all of the students birthday in a text file in the main program folder. It gets cluttered in there and so for the next version I would like to add a sub folder called StudentBdays, and when I add that to my app path so when the program saves the students birthday it looks like this..


Open App.Path & "StudentBdays\StudentBday1.txt" For Output As #iFileNo

However I get an path not found error message. Did I add the folder name wrong? Thanks!

Converting a number from one calculation to a value of another calculation

$
0
0
I have this program that does the following:

R = 252
G = 4
B = 4

Results = (R * 65536) Or (G * 4096) Or B

which gives the results of 16516100

Now I know this value is not the value I need and I have no idea why the programmer did it this way

If I convert I do it this way:

Results = (B * 65536) + (G * 256&) + R

which gives the results of 263420. I know that this value is correct for what I want.

My question is this:

When I encounter the first value, 16516100, knowing how it was calculated how do I
change it to 263420 ?

How exactly do you reinitialize RND in VB6?

$
0
0
According to the vb6 help file. You can reinitialize RND by using a negative number, where the positive equivalent of that number is the random seed. It says:

"If number is------------------Rnd generates"
"Less than zero---------------The same number every time, using number as the seed."

Now to test this, since the default initial seed for RND is 327680, I've decided to reset it to this.

Code:

Print Rnd
Rnd -327680
Print Rnd

Strangely enough I found that the second call to Print Rnd did NOT generate the same output as the first call to Print Rnd.
Thinking that maybe the very act of calling "Rnd -327680" also caused it to output, I decided to test that theory using this code
Code:

Print Rnd
Print Rnd(-327680)

Again I found that the second call to Print Rnd did NOT generate the same output as the first call to Print Rnd.

Then I turned to online sources and found I needed a Randomize statement. So I tried this
Code:

Print Rnd
Rnd -1
Randomize 327680
Print Rnd

This also didn't work to truly reset it to the same state as when the program starts. Neither did the next several codes I tried

Code:

Print Rnd
Randomize 327680
Rnd -1
Print Rnd

Code:

Print Rnd
Randomize 327680
Print Rnd(-1)

Any assistance on how to reset Rnd to the same initial state as when the program starts will be much appreciated.

Input value within line of data

$
0
0
Hi,

I have a file which contains values such as

Print #ff, "IK_" & UCase(txtAction(0).Text) & "=(Gamekey=GI_AxisLeftY,Value=1.000000)"

I only need to retrieve the text that was saved in the textbox.

For example the output of the above line would be

IK_UP=(Gamekey=GI_AxisLeftY,Value=1.000000)

I only need retrieve the value that was in the textbox.

I have tried using instr:

InStr(4, entry, "=(Gamekey=", vbTextCompare)

however, for some reason it just returns numbers rather than the data that is actually in the file.

Thanks,


Nightwalker

mismatch error

$
0
0
last night my code for searching students is working then I run it again and it says mismatch error and it would show null values inside the rs! field
Code:

Private Sub Form_Load()
OpenCon
    Set rs = New ADODB.Recordset
    rs.Open "Select * From [tblstud_reg]", con, adOpenStatic, adLockOptimistic
    ListView1.ListItems.Clear
    If rs.RecordCount <> 0 Then
        For x = 1 To rs.RecordCount
            frmsearchstud.ListView1.ListItems.Add , , rs![stud_no]    'error appears here
            frmsearchstud.ListView1.ListItems(frmsearchstud.ListView1.ListItems.Count).ListSubItems.Add , , rs![last_name]
            frmsearchstud.ListView1.ListItems(frmsearchstud.ListView1.ListItems.Count).ListSubItems.Add , , rs![first_name]
            frmsearchstud.ListView1.ListItems(frmsearchstud.ListView1.ListItems.Count).ListSubItems.Add , , rs![middle_initial]
            frmsearchstud.ListView1.ListItems(frmsearchstud.ListView1.ListItems.Count).ListSubItems.Add , , rs![grade_level]
            rs.MoveNext
            Next
    rs.Close
con.Close
End If
End Sub


Timer interval problem

$
0
0
Guys, please help me. I am currently using vb6. I am doing a computer timer system. I want to know the way how to compute minutes to price. For every 4 mins,
4mins = P1.00. I am totally jammed here. Guys please help me find a way how to do it.. I searched the net that the maximum interval for timer in vb6 is 65535 which is
only 1 min. Please help me.. thanks a lot...

Outlook 2010

$
0
0
Hello All

Lately at the office they be getting more modern software, bit of a disadvantage for me for i use my proggy to start default email and add subject and mailto adress. But now we have OFFICE 2010 and it doesnt work anymore. Starting it as a Shell is OK but i wander if it is possible to start office 2010 (and check if it is open already)
Then open a new email and disconnect from office.

What i found was this, its of great help but i fail to add some stuff a bad programmer if anything



Private Sub Command6HY_Click()

Dim olApp As Outlook.Application
Dim myNameSpace As Outlook.Namespace
Dim myFolder As Outlook.MAPIFolder
Dim myExplorer As Outlook.Explorer
Dim olNewEmail As Object

On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")


If Err.Number <> 0 Then
Set olApp = New Outlook.Application
Set myNameSpace = olApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
'There are no explorer windows so create one
Set myExplorer = Application.Explorers.Add(myFolder)
'Choose the inbox folder
myExplorer.CurrentFolder = myFolder
myExplorer.CurrentView = "Messages"
'Display the sucker
myExplorer.Display
Else
Set myNameSpace = olApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
'Explorer already exists so use the active explorer
Set myExplorer = Application.ActiveExplorer
'Change display to the inbox folder and display
myExplorer.CurrentFolder = myFolder
myExplorer.CurrentView = "Messages"
myExplorer.Display
End If

Set olNewEmail = olLook.CreateItem(0)


olApp.Quit
Set myExplorer = Nothing
Set myFolder = Nothing
Set myNameSpace = Nothing
Set olApp = Nothing
Set olNewEmail = Nothing

end sub

It appears to be starting OUTLOOK but only in the menu bar for a few seconds. If im quick enough it i can select open else the icon dissapears (might be kaspersky doing that). The olnewmail doesnt do anything wherever i place it.
Is there a way to completely start OUTLOOK, go for a new email and add to adress, subject ="subject" and a text "bla bla bla"

We are not allowed to sent data through your own proggy so i need to simply (completely) open OUTLOOK and configure it to the required text and email adres.

Thanks in advance

hex to unicode and unicode to hex converter needed

$
0
0
I am developing an application where i am receiving data in hex but i need to convert in to unicode format to show. if any one can help me.

Is there a way to make text blink in a COMMAND BUTTON ?

$
0
0
Is there a way to make text blink in a COMMAND BUTTON ?

can you please give one example.

THANK YOU...

OLE iexplore.exe

$
0
0
When i embed iexplore.exe using ole to my project it shows as an icon? I want it to show the IE itself!
Viewing all 21905 articles
Browse latest View live


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