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

how can i load and save documents and view them later

$
0
0
hey
i am trying to save AND load documents of customers
like pdf or word and view them
tnx for any help
salsa31 :)

how can i display in a listview the most top income from customers

$
0
0
hey
i have a table called TempCash
i want to know which customer is more profit for me
e.x
Code:

  mambo income:15600$
  salsa income:25000 $
  david income:9066$

the most profit customer will be in the top of the list

Code:

DataBase Name:TempCash
TempCust = customername = Text
TempPay = Income = Currency

regards :)
salsa

VB6 equivalent to .Net BindToMoniker call?

$
0
0
Is there an equivalent in VB6 to the .Net
System.Runtime.InteropServices.Marshal.BindToMoniker() call? I would like to be able to call this in Excel for specific reasons.

LED Light Controlling on PC!

$
0
0
Hi dears :wave:
How can I control turning on/off my LED light connected to PC (by VB 6.0), I want to turn on/off automatically in different times.

Name:  led.jpg
Views: 51
Size:  22.7 KB
Attached Images
 

How to pass combobox value in a form to crystal report

$
0
0
so i made this report with crystal report, and I want to pass the value from comboboxes (lets say the names are cmbmonth, and cmbyear) in the form to the report.

how can i achieve this? i only know how to use database fields in cr, and this is the code that i call to launch the report :

Code:

Sub cetak()
Call koneksi
cr.SelectionFormula = "{penggajian.kd_transaksi}='" & tkdtrans & "'"
cr.ReportFileName = App.Path & "\StrukGaji.rpt"
cr.WindowState = crptMaximized
cr.RetrieveDataFiles
cr.Action = 1
End Sub

any help will be appreciated, thanks in advance

Help with extracting data from WebBrowser control

$
0
0
Hi,

I need to extract specific text from an HTML page that my code loads into a standard VB6 Classic WebBrowser.

In the HTML below, I need to extract 'AAAA8927738, BXBX4321786, GFHJ5432987 and JKYU43907688'

There are times that there are only 3 letters on the front of each of the data that I need. The data will be different each time, but always in the same location in the HTML.

The HTML extracts below are part of a 36kb-50kb long HTML file that my code loads.

Can anyone help, please.

<TD><A href="http://mydom.com/Abc/Box/F19.aspx?term_cd=OMSFT&amp;ctr_key=9985550&amp;LiveFlag=">AAAA8927738 </A></TD>

<TD><A href="http://mydom.com/Abc/Box/F19.aspx?term_cd=OMSFT&amp;ctr_key=9985550&amp;LiveFlag=">BXBX4321786 </A></TD>

<TD><A href="http://mydom.com/Abc/Box/F19.aspx?term_cd=OMSFT&amp;ctr_key=9985550&amp;LiveFlag=">GFHJ5432987 </A></TD>

<TD><A href="http://mydom.com/Abc/Box/F19.aspx?term_cd=OMSFT&amp;ctr_key=9985550&amp;LiveFlag=">JKYU43907688 </A></TD>

Thank you.

Regards,
TJ

[RESOLVED] Object of class as an argument of method [Help]

$
0
0
I typed this method in a class called "clsDealer" and I make the arguments of this method objects of that class, but the program doesn't work well, is this way not legal in VB 6 and how can I pass an object as an argument of method or sub.

Code:

Public Sub CardsComp(A As clsCard, B As clsCard)
A.CardGenerate
B.CardGenerate
If A.Card >= B.Card Then CardsComp
End Sub

Browse for file - defaulting to a known location

$
0
0
Is there a way to do this in VB6, please ?

CommonDialog vb6/sp6 (continuation of earlier post)

$
0
0
LaVolpe and SamOscarBrown were correct. I did not have a CommonDialog icon on my form. Now I do have. But I also am still having problems. SamOscarBrown's response said "if you have the Properties section open in your IDE..." What is the IDE?
when I right click on any other control, then select Properties, I see the Propertiies listing, starting with Name, Appearance, etc. When I right click on the CommonDialog then select Properties, I get Properties Page that looks entirely different. What am I doing wrong?

Can we go about this another way? Is there anyone on the forum that I could grant on-line access to my computer to examine my code (with my guidance, and for a fee) and help me out?

Hal W
Houston, Tx

Sorting SQL Table using a variable

$
0
0
Hi
SQL Table with many columns I want to find all the records with the same Year
Code:

Dim iYear as Long
Titles.strSQLYear = "SELECT * FROM Banking WHERE Year = " & iYear

When I load the selected data it displays a differant Year
when I debug Titles.strSQLYear the select statement is correct

Tracking No Or Auto No For Entries With The Same Product Id and Invoice

$
0
0
Hello friends! I am trying to do a simple thing and let me make it clear first. I've a excel file and it's being loaded by an application to store excel data in a database table. It works fine and uploads data. Now I've a requirement in this scenario and the following is the excel sheet:

Code:

ProductId - Invoice No - Invoice Date - Price - Quantity
101 - Inv-1000 - 7/10/2017 10:00 - 1000 - 10
101 - Inv-1000 - 7/10/2017 10:30 - 200 - 2
102 - Inv-1000 - 7/10/2017 10:30 - 400 - 20
101 - Inv-1001 - 7/11/2017 10:30 - 300 - 5
102 - Inv-1001 - 7/11/2017 10:30 - 200 - 5

See in the excel sheet, product id 101 has two entries with the same invoice no with different timing and quantities. What I want is to create a tracking no whenever there are similar invoice no and product id (Repeated invoice no and product id). Suppose, for product id 101, it has already two entries with invoice no 'Inv-1000'. So it should create two different tracking no like 1 and 2 as follows in a database table:

Code:

ProductId - Invoice No - Invoice Date - Price - Quantity - Auto No
101 - Inv-1000 - 7/10/2017 10:00 - 1000 - 10 - 1
101 - Inv-1000 - 7/10/2017 10:30 - 200 - 2 - 2
102 - Inv-1000 - 7/10/2017 10:30 - 400 - 20 - 1
101 - Inv-1001 - 7/11/2017 10:30 - 300 - 5 - 1
102 - Inv-1001 - 7/11/2017 10:30 - 200 - 5 - 1

I tried to use the following code to do the above task but it creates only 1 for all the entries even for the repeated ones:

Code:

Do Until rs3.EOF
  If (rs4.recordCount > 0) Then
    generateId = rs3.Fields.Item("Auto No") + 1
  Else
    generateId = 1
  End If         
rs3.MoveNext
Loop

Seems like I am missing something and I've included a sample project to check upon it. Any idea or suggestion would be appreciated in this regard. Thanks.

Note: I am validating the column names right now means if the excel sheet column doesn't match the table column, then it will not allow to upload data. Similarly, I've tried to validate row data of the excel sheet. In this case, if product id 101, invoice no 'Inv-1000' is in the table already and even with different tracking like 1, 2 already existed, then it shouldn't allow this data to be uploaded further. It looks simple but don't get to work. Struggling! Sample - Existed in the table:

Code:

ProductId - Invoice No - Invoice Date - Price - Quantity - Auto No
101 - Inv-1000 - 7/10/2017 10:00 - 1000 - 10 - 1
101 - Inv-1000 - 7/10/2017 10:30 - 200 - 2 - 2
102 - Inv-1000 - 7/10/2017 10:30 - 400 - 20 - 1
101 - Inv-1001 - 7/11/2017 10:30 - 300 - 5 - 1
102 - Inv-1001 - 7/11/2017 10:30 - 200 - 5 - 1

Finally will not allow in the next upload for the above data. One more thing, keep the file in D directory and in the TextBox, write this to upload the excel file - D:\SampleExcel.xlsx
Attached Files

How I need use Sum in database

$
0
0
Hello

How I need use Sum in database



i use this code but is not working:


Call connect_Database

With rs_find
If .State = adStateOpen Then .Close
.Open "select sum (Amount) as TotalSum from Table", con, adOpenDynamic, adLockPessimistic
Text1 = rs.Fields!TotalSum
.MoveNext
.Close
End With

Another dumb question: Using an string array

$
0
0
I uses a lot strings arrays to store lists.

and a very common procedure for inserting elements or deleting elements is.

if y<lastone then
for x=y to lastone-1
a$(x)=a$(x+1)
next x
lastone=lastone-1
endif

this for deleting an element.

and



lastone=lastone+1
a$(lastone)=string


this for adding one.

of course in bigger list.

I uses a parallel boolean array which run parallel to indicating if an element if in use or not, this allow to deleting elements in middle of the array and avoid to move the nexts elements one index above.

But then in every inspection there is the need to check first that boolean value , if true, the element exists, in every procedure that checks the list. And then is necessary to regularly maintain the list, check if the b(lastone) = false , so lastone = lastone-1.

Is this the faster way to handle this ?

I mean in VB, what does when A$ = B$ ¿It just copy the variable's internal pointer, or it duplicate the stored string plus free / malloc?.

How to disable windows system shortcuts programmatically

$
0
0
Hi to all. I am about to make a new screensaver. I have new idea. I am going to lock all Windows shortcuts like Ctrl+Alt+Delete, Ctrl+Escape, Alt+Tab,… etc only with mouse move event I am going to ask a password. Then unlock the screen. How to do this I have no idea. I have restricted time so that asked in this forum. Try to solve this at the same time like you from net cloud. I would be much appreciated…
Regards
algea

[RESOLVED] Can you have a constant array?

$
0
0
Something like this in the declarations

Public xyz= Array("One", "Two", "Three")

Thanks.

Problems with folder selection dialog box

$
0
0
I am trying to put in place a feature in a program to let the user browse and select a folder, and in the end store the user's selection (the selected folder) in an InkEdit textbox.
I searched and found this thread:
http://www.vbforums.com/showthread.p...-path-resolved
In the post#2 in there RhinoBull has provided a good piece of code that does this job.
So, I copied it into my project and made some small modifications to make it fit my needs.
Here is my code based onRhinoBull's initial suggestion:
Code:

Public Function OpenFolderInDialogBox(ByRef DlgTitle As String, ByRef FormhWndOwner As Long) As String
  '=============================
  Dim lpIDList As Long
  Dim sBuffer As String
  Dim sTitle As String
  Dim tBrowseInfo As BrowseInfo
 
  sTitle = DlgTitle       
  With tBrowseInfo
            .hWndOwner = FormhWndOwner            '      Me.hwnd
            .lpszTitle = lstrcat(sTitle, "")
            .ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN _
                        + BIF_EDITBOX + BIF_NEWDIALOGSTYLE
  End With
  lpIDList = SHBrowseForFolder(tBrowseInfo)
  If (lpIDList) Then
            sBuffer = Space(MAX_PATH)
            SHGetPathFromIDList lpIDList, sBuffer
            sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
            OpenFolderInDialogBox = sBuffer
  End If
End Function

And here is how I call it:
Code:

  InkEdit1.Text = OpenFolderInDialogBox("Input Folder", Me.hwnd)
The API declarations are the same as RhinoBull's code. I have not changed them.
At first it appeared that it worked fine, but after close inspection, I see that there are a number of problems with it:

1. This code does not return unicode folders properly because my InkEdit box shows question marks instead of foreign characters. It only shows English characters correctly.
This is not a problem with the InkEdit because I can paste any foreign character including Chinese characters in that same InkEdit box with no problem.
Therefore this is a problem with the above code. How can I fix the above code to return foreign characters correctly?

2. In the beginning when the folder browse dialogue box pops up it shows Desktop, This Pc, Libraries, external hard drives (F:\, G:\, H:\) but not C:\
I have to click on "This PC" to expand it and see all the disk drives (C:\, E:\, F:\, G:\, H:\, ).
How can I make it show a specific folder in the beginning when it pops up, so that the user can navigate from there?

3. The folder browse dialog box shows the "current folder" that the user is navigating on the bottom of it in front of the label "Folder:" For example the Chinese folder in this screen print:
http://i.imgur.com/c8lHjwL.jpg
But that is just the folder name (サンシャイン-阳光-солнечный). How can I make it show the full folder path (C:\temp2\test4\サンシャイン-阳光-солнечный) in there?

4. If the user clicks on "Cancel", the above code erases whatever already had existed in that InkEdit.
How can I fix it so that in case of a "cancel" the text in the InkEdit would remain unchanged?

5. I can pass a title to the above function and it will show that as the secondary title of the folder browse dialog box. In the above example and the screen print, that title is "Input Folder".
But the main title of that dialog box is "Browse for folder". How can I change that one too?

Please advise.
Regards
Ilia

[RESOLVED] Multilines without its property [help]

$
0
0
I remember something we were doing when we were typing text inside the textbox or a label but I'm not sure, something to make multi-lines without changing the Multiline property, something like enter pressing but if we press enter while we typing our text, we will not have a new line to continue but the property of text or caption will consider that we finished our typing.

Drag & Drop of CommandButton many times

$
0
0
Hello!

I have a picturebox with a picture of a map and I need to mark locations.

I need to create a CommandButton that I can drag and drop many times in the map.
I mean, when I move the button to the map, I can see two buttons: the first button and the button in the map.
When I move the original button another time. I can see 3 buttons: two buttons in the map and the original button.

How can I do this? Thank you!!

Can we coding in VSCode?

[RESOLVED] Picture is not stable (hide/show) jumping

$
0
0
Hi dears
This is my code, at runtime loaded picture is not stable (hide/show) how to load it stable.
I think my app is not sure loaded picture correct or not (not decided yet) :p :D
Please help

Code:

Private Sub Timer1_Timer()
If  Val(L1.Caption) = 1 Then
BLP.Picture = LoadPicture(App.Path + "\BL\NET10A.ICO")
L2.Caption= "Yes"

ElseIf Val(L1.Caption) = 0 Then
BLP.Picture = LoadPicture(App.Path + "\BL\NET10B.ICO")
L2.Caption= "No"

Else
BLP.Picture = LoadPicture(App.Path + "\BL\NET10B.ICO")
L2.Caption= "Unknown"

End If
End Sub

Note:Timer Interval is 500
Viewing all 21822 articles
Browse latest View live


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