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

shift key & replay key features

$
0
0
Hi...

i got problem doing 'shift' & 'replay' key features for my calculator. i try to follow up and change a bit the coding i got in the internet somehow there is an error

[RESOLVED] Is there a way to thicken or reduce the thickness of drawing on a blank picturebox?

$
0
0
Hi there everyone! I am working on a tool that lets me write on a picturebox, and combines it with teaching tools. I have it set up now to write on the picturebox like this..

Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Picture1.PSet (X, Y)

End If
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
Picture1.Line -(X, Y)



End If
End Sub

Now this works great. I can write on the board, but it would come in handy if I could thicken, or reduce the thickness of the 'ink" of the mouse cursor. Is there a way to at least thicken it, sort of like the boarder thickness option on shapes?

THANKS!

How i want to show help in VB

$
0
0
hi

here i attached you my calculator sample...i want whenever ppl click the help button,it will show content as well as about.i did the coding somehow it said 'variable not define'...anybody can help..

Private Sub about_Click()
nachelp.Show
End Sub

Private Sub contents_Click()
naccalc.Show

End Sub

[RESOLVED] How to use FloodFill

$
0
0
I'm trying to color an area using the FloodFill API

I have a Picturebox with a circle in it. The color of the circle is red and the color of the area around the circle is white.

I want to color the circle blue if user clicks on it

Here is my code which doesn't work

Code:

  '
Private Sub Picture1_Mousedown(Button As Integer, Shift As Integer, x As Single, y As Single)
 Dim ColorUnderMouse As Long
   
 ColorUnderMouse = Picture1.Point(x, y)
 
 Select Case ColorUnderMouse
  Case vbRed
    FloodFill Picture1.hdc, x, y, vbBlue
 End Select
  '
  '

extract links with eatch name next to it from textbox

$
0
0
i was searching i cant find it so am opening a thread.

here is my work i will post few lines of code but it has more i will not add it here ,dont want to rename all

please can you help me , i need this added to listview and to be shown like this

listview1 please ignore the etc text
==========================================================
name | Link
Interview With A ladoo (2012) |movie/1282280/download-interview-with-a-ladoo-2012.html
Interview With A ladoo2(2012) | movie/1281262/download-interview-with-a-ladoo2-2012.html


Code:

<td class="vertTh">Movie</td>
                                                <td class="crop"><a target="_blank" href="movie/1282280/download-interview-with-a-ladoo-2012.html">Interview With A ladoo (2012)</a></td>
                                                <td>9 days ago</td>
                                                <td class="crop provider">4* <!--<a href="/site/exampe.com">-->Psycho Downloads<!--</a>--></td>
                                        </tr>
                                                                        <tr class="alt">
                                                <td class="vertTh">Movie</td>
                                                <td class="crop"><a target="_blank" href="movie/1281262/download-interview-with-a-ladoo2-2012.html">Interview With A ladoo2(2012)</a></td>



please only the ones with .html and rest i dont want

example there are <!--<a href="/site/exmple.com">--> i dont want
i only want .html with there own names

[RESOLVED] How i want to show help in VB

$
0
0
hi

here i attached you my calculator sample...i want whenever ppl click the help button,it will show content as well as about.i did the coding somehow it said 'variable not define'...anybody can help..

Private Sub about_Click()
nachelp.Show
End Sub

Private Sub contents_Click()
naccalc.Show

End Sub

Database using Case Select as per textbox

$
0
0
Hi guys,
I have a program here using access as database. What in trying to figure out is how i can use the correct database/table as per textbox indicated. I have frmmain, frmproductsearch, a textbox (txtdepotcode) and database (database) with table (product, product1, product2, product3, product4, product5 and product6) command button(cmdsearchproduct). Lets say I typed 0 at the textbox (txtdepotcode) when i click command button(cmdsearchproduct), frmproductsearch will show up using product as its table and so on and so fort. Im thinking of using Select Case Statement. Below are some of the codes ive tried:

Code:

Private Sub cmdsearchproduct_Click()
frmproductsearch.Show
End Sub

Code:

::::frmproductsearch::::

Option Explicit
Dim lst As ListItem
Dim lst1 As ListItem
Dim productcode As Long
Dim warning As String
Dim countertitle As Integer

Public Sub FillListView()

Set lst = lvproduct.ListItems.Add(, , txtcode.Text)
    With lst
            .SubItems(1) = rs!code
            .SubItems(2) = rs!erb
            .SubItems(3) = rs!Description
            .SubItems(4) = rs!enterby
            .SubItems(5) = rs!casesize
            .SubItems(6) = rs!unitsize
            .SubItems(7) = rs!category
            .SubItems(8) = rs!subcategory
           
            End With
End Sub

Private Sub cmdproductsearchclose_Click()
Unload Me
End Sub

Private Sub cmdrefresh_Click()
lvproduct.ListItems.Clear
    Call GetProductRecord
End Sub

Private Sub Form_Load()

txtcode.Text = 1

Call GetProductRecord
Connection

sql = "SELECT code FROM product"
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
    With rs
        .MoveLast
            txtcode.Text = !code + Val(1)
        .Close
    End With
End If
   
End Sub

Public Sub GetProductRecord()
Connection

sql = "product"
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenDynamic, adLockOptimistic
Do Until rs.EOF
    Set lst1 = lvproduct.ListItems.Add(, , rs!code)
        With lst1
            .SubItems(1) = rs!erb
            .SubItems(2) = rs!Description
            .SubItems(3) = rs!enterby
            .SubItems(4) = rs!casesize
            .SubItems(5) = rs!unitsize
            .SubItems(6) = rs!category
            .SubItems(7) = rs!subcategory

            End With
    rs.MoveNext
Loop
rs.Close: Set rs = Nothing
End Sub

Private Sub lvproduct_Click()

End Sub

Private Sub txtproductcategory_Change()
lvproduct.ListItems.Clear
Connection
'Call connect
sql = "SELECT * FROM product WHERE category LIKE '" & Trim(txtproductcategory.Text) & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
Do Until rs.EOF
    Set lst1 = lvproduct.ListItems.Add(, , rs!code)
        With lst1
            .SubItems(1) = rs!erb
            .SubItems(2) = rs!Description
            .SubItems(3) = rs!enterby
            .SubItems(4) = rs!casesize
            .SubItems(5) = rs!unitsize
            .SubItems(6) = rs!category
            .SubItems(7) = rs!subcategory

        End With
    rs.MoveNext
Loop
End If
rs.Close: Set rs = Nothing
End Sub

Private Sub txtproductcode_Change()
lvproduct.ListItems.Clear
Connection
sql = "SELECT * FROM Product WHERE UCase(code) LIKE '%" & UCase(txtproductcode.Text) & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
Do Until rs.EOF
    Set lst1 = lvproduct.ListItems.Add(, , rs!code)
        With lst1
            .SubItems(1) = rs!erb
            .SubItems(2) = rs!Description
            .SubItems(3) = rs!enterby
            .SubItems(4) = rs!casesize
            .SubItems(5) = rs!unitsize
            .SubItems(6) = rs!category
            .SubItems(7) = rs!subcategory
           
        End With
    rs.MoveNext
Loop
End If
rs.Close: Set rs = Nothing
End Sub


Private Sub txtproductdescription_Change()
lvproduct.ListItems.Clear
Connection

sql = "SELECT * FROM Product WHERE UCase(Description) LIKE '%" & UCase(txtproductdescription.Text) & "%'"

Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
Do Until rs.EOF
    Set lst1 = lvproduct.ListItems.Add(, , rs!code)
        With lst1
            .SubItems(1) = rs!erb
            .SubItems(2) = rs!Description
            .SubItems(3) = rs!enterby
            .SubItems(4) = rs!casesize
            .SubItems(5) = rs!unitsize
            .SubItems(6) = rs!category
            .SubItems(7) = rs!subcategory
           
        End With
    rs.MoveNext
Loop
End If
rs.Close: Set rs = Nothing
End Sub


Looking forward for your help,
Chino:)

[RESOLVED] what happen to my vb??

$
0
0
Hi ev1~i dont know what i press...i cant see my properties:(..help me
Attached Images
 

[RESOLVED] Deleting content from table. Error: "Object required"

$
0
0
Hi

I'm very new to visual basic (doing some programming based on copy/paste from some code I've been handed).

I'm trying to clear a table (Plotdata) but I get the error "Object required". My code is as follows. The error occurs in the line marked with (*****)

Dim SQLquery As String
Dim db As DAO.Database
Set db = DBEngine.OpenDatabase(backendlink)
Dim Plotdata As DAO.Recordset
currentdb.Execute "DELETE * FROM Plotdata" (******)
Set Plotdata = db.OpenRecordset("Plotdata", dbOpenDynaset, dbAppendOnly)


I guess there is something fundamentally wrong and as I said: I'm totally green, so I excuse myself already.

Best regards.

Table is empty after writing to it

$
0
0
Hi

I have trouble writing to a table after clearing it. I print the table to a .doc file which is totally empty when I open it.
My code is:
Dim SQLquery As String
Dim db As DAO.Database
Set db = DBEngine.OpenDatabase(backendlink)
Dim Plotdata As DAO.Recordset
db.Execute "DELETE * FROM Plotdata"
Set Plotdata = db.OpenRecordset("Plotdata", dbOpenDynaset, dbAppendOnly)

Plotdata.AddNew
Plotdata!Command = "{\rtf1\ansi\deff0{\fonttbl{\f0 Verdana;}}"
Plotdata.Update

Plotdata.AddNew
Plotdata!Command = "{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}"
Plotdata.Update

Plotdata.AddNew
Plotdata!Command = "\landscape"
Plotdata.Update

Plotdata.AddNew
Plotdata!Command = "\paperw" & Round(29.7 * twips, 0) & "\paperh" & Round(21 * twips, 0) & "\margl" & 1 * twips & "\margr" & 1 * twips & "\margt" & Round(2.5 * twips) & "\margb" & 1 * twips
Plotdata.Update

Plotdata.AddNew
Plotdata!Command = "\fs18"
Plotdata.Update

Plotdata.AddNew
Plotdata!Command = "Hængerdokumentation"
Plotdata!Command = Plotdata!Command & " genereret den " & Date & " " & Time & "\line"
Plotdata.Update

Dim filehandle As Integer
filehandle = FreeFile

Filnavn = "C:\RAMCATS\test.doc"

Open Filnavn For Output As #filehandle

Plotdata.MoveFirst
Do Until Plotdata.EOF

cmd = Plotdata!Command
Print #filehandle, cmd
Plotdata.MoveNext
Loop


I would expect to see the word "Hængerdokumentation" and the date and time stamp... but the document is completely empty.

Best regards

split function

$
0
0
Hi friends, i want to returns Medium indigo
Lilac Mix
Navy Mix
Tobacco
E0_Blue
same way .because these text is not fixed in between .some times 8 digit sometimes 7 digit and sometimes 4 digit .so on
but most of them is based on underscore . is there any function on excel so that i returns like a split function of vb6.
Code:

T62_8505Y_RBC HOOP ACRUX:QQ_MEDIUM INDIGO:16_STD
T01_5347I_ACORN PRINT SCARF:G4_LILAC MIX:1SIZE
T43_8625_TQ ENG STRIPE:F4_NAVY MIX:16
T54_6014_CROP CARGO:TE_TOBACCO:12
T62_9243Y_NANCY TIER SKT:E0_BLUE:14_89
T43_2589_FIREWORK SEQUIN T:T4_GREY MIX:16
T57_8240_LINEN VIS TROUSER:Y0_BLACK:14_MED
T57_2209H_FLIPPY POLY SKIRT:Y0_BLACK:16_39
T43_2324_SS SHIRR PKT FRNT:J0_GREEN:16
T57_5593K_FRENCH CREPE WIDE:SS_STONE:14_SHT
T43_2860_SS PLT SHELL SPEC:Y8_BLACK OVERDYE:12
T41_2579M_STRIPE LACE RAGLA:U8_BURGUNDY MIX:16
T41_5013A_OPP VEST:SG_SUGAR PINK:14
T41_5013A_OPP VEST:SG_SUGAR PINK:14
T41_7030A_WHITE  FLR LINEN:Z4_WHITE MIX:16
T43_2620_TQ GRAPHIC TUNIC:D4_PURPLE MIX:14
T43_2620_TQ GRAPHIC TUNIC:D4_PURPLE MIX:14
T41_2341J_SPARKLE CARDI:E1_LIGHT BLUE:12

help~my trigonometry button are not working

$
0
0
Hi i did create tan,sin,cos button by writing this code,somehow when i want to press,the equal button doesnt show the answer:

Private Sub Trigonemetry_Click(Index As Integer)
scitype = Trigonemetry(Index).Caption
Select Case (scitype)
Case "sin"
lblDisplay.Caption = (lblDisplay.Caption * 3.14) / 180
lblDisplay.Caption = Math.Sin(Val(lblDisplay.Caption))
count1 = 0
Case "cos"
lblDisplay.Caption = (lblDisplay.Caption * 3.14) / 180
lblDisplay.Caption = Math.Cos(Val(lblDisplay.Caption))
count1 = 0
Case "tan"
lblDisplay.Caption = (lblDisplay.Caption * 3.14) / 180
lblDisplay.Caption = Math.Tan(Val(lblDisplay.Caption))
count1 = 0
End Select
End Sub

Simple Family Feud Code?

$
0
0
Hi, I am considering working on a Family Feud game using VB6, but I am wondering how to make the code simpler and more efficient?

I plan to use the format used in the current Steve Harvey run (Single-Single-Double-Triple-Sudden Death).

[RESOLVED] How to extract from info from textbox ?

$
0
0
Hello,

I have a textbox and I want to extract only last 90 characters from it

example

Code:

Client-002: Found-ada561aede0bb0fd867dc9341b9a9e6e2f3862cc:003537900496778600:070401090308010208000208060706
so I only want to extract last 90 characters which are

Code:

ada561aede0bb0fd867dc9341b9a9e6e2f3862cc:003537900496778600:070401090308010208000208060706
my code now only delete first 20 characters

Code:

Private Sub Command1_Click()
Dim txt As String, SearchTxt As String
    Dim Pos As Long, CurPos As Long, CurSel As Long
   

    rtbText.Text = rtbChat.Text
    rtbChat.SetFocus
   
    SearchTxt = "Found-"
   
    CurPos = rtbChat.SelStart
    CurSel = rtbChat.SelLength
   
    txt = rtbChat.Text
    Pos = InStr(1, txt, SearchTxt) - 1
   
    If Pos > -1 Then
        rtbChat.SelStart = Pos
        rtbText.Text = rtbChat.Text
        rtbText.SelStart = 0
        rtbText.SelLength = 20
        rtbText.SelText = ""
       
  End If
End Sub

How do I control the sequence of connection order

$
0
0
In my client/server project I need to control the order of connection from two different remote sockets.

Here's the situation:

All users connect to ServerA first. ServerA verifies the user is valid. ServerA sends the user the IP and Port number of a chat server, tells user to disconnect from ServerA and then connect to the chat server.

There are two servers running, Server1 and Server2, each with one or more users connected to them

Both servers are connected to each other and also connected to a master server called ServerA

Server2 fails. When this occurs ServerA's _Close() event is fired and also the users _Close() event is fired for the user on Server2.

When ServerA's _Close() event is fired ServerA closes the server's socket, does some house cleaning, and continues on as normal,

When the user's _Close() event is fired it closes the server's socket (Server2 in this case) and reconnects to ServerA in the same fashion it did the first time so it can be re-connected to another server (Server1 in this case).

Here's what I need to control:

ServerA must first take care of house cleaning before it can allow the client to connect otherwise things are out of sequence and tables are not finished which will cause problems if client connects before ServerA has finished doing house cleaning.

How do I make sure that ServerA has finished house cleaning before the users re-connect?

[RESOLVED] Avoiding duplicates

$
0
0
I'm building a list of names into a Listbox.

The names are in a string variable like this:

strNames = "name1,name2,name3,name4,"

I then split these names into an array:

Dim a() As String

a = Split(strNames, ",")

So,

a(0) = Name1
a(1) = Name2
a(2) = Name3
a(3) = Name4
a(4) = "" because there is a comma at end of strNames

Then I loop:

Code:

For n = 0 To UBound(a)
  If a(n) = "" Then Exit For
  lstNames.AddItem a(n)
 Next n

Everything OK. However, under certain circumstances it will be this way:

strNames = "name1,name2,name2,name3,"

I then split these names into an array:

Dim a() As String

a = Split(strNames, ",")

So,

a(0) = Name1
a(1) = Name2
a(2) = Name2
a(3) = Name3
a(4) = ""

Then I loop:

Code:

For n = 0 To UBound(a)
  If a(n) = "" Then Exit For
  lstNames.AddItem a(n)
 Next n

What is the best way to avoid getting Name2 in the lstNames listbox two times?

Having turble with RichTextBox1.LoadFile

$
0
0
Hi, When I try to test the program it highlights LoadFile my loadfile looks like this
RichTextBox1.LoadFile "C:\User\jhon\desktop\comm.txt and it says this Compile Error:Method or data member not found.
Please Help thanks

The $25,000 Pyramid

$
0
0
I have been working with VB for 4 years this week, and as I stated in the Family Feud thread I created earlier today, it seems as if I am interested in learning how to use fewer lines of code instead of using hundreds or even over a thousand lines of code.

I am considering developing a game based on The $25,000 Pyramid, a game show hosted by Dick Clark during the 1980s.

Here is a video to view so that it may give some idea on how to code the game with as few lines of code as possible:

http://www.youtube.com/watch?v=7RJaGKwJjb4

There are two parts to the game. Contestant picks a category on the board, then the host tells one of the team players to describe to the partner something related to the "mock" category (i.e. "Christmas is Coming" on the board means that the true category is "things associated with Thanksgiving", etc.). Player is given so many seconds to get as many as 7 correct. After all 6 categories are used up, or if the difference between the two scores is greater than 7 after three or more questions (one player has 14 points and the other player has 6 points), whoever is in the lead goes to the winner's circle.

The first winner goes to the end game (the Winner's Circle) and plays for $10,000. If that same player goes to the second Winner's Circle round in the same show, he or she plays for $25,000.

I read about a "Do While" situation on another thread. Is there any way such situation could be possible with what gameplay is used on the clip? It seems as if a "Do While" makes the code a bit more efficient and cuts down on lines of code.

Mysterious function in API

$
0
0
Hi all.

I was researching how to work with Unicode in a textbox and ran into one piece of code involving the function, SendMessageWLng(), as in:
Quote:

SendMessageWLng(RTB.hWnd, EM_GETTEXTLENGTHEX, VarPtr(gtlUnicode), 0)
The author did not post his declarations or constants.

Problem is, I cannot find any reference to this function on MSDN, any of the API refs, or ref programs.

This must be a function held in great reverence in a Masonic temple attic somewhere! :)

Is it the Win API or some other? If not, can someone steer me to the alternate universe where it exists, cause I really need it!

Resize a picturebox?

$
0
0
Hello everyone! I am working on a simple tool to write on these touch screens they have at school now, so I have been using a picturebox to write in. It does the job very well, but the only issue, so sometimes I would like to minimize the picturebox into a thumbnail, and add a new picturebox so I would essentially have a new "slide". I can resize the used picturebox to a certain size, and stretch it so it looks smaller so I can refer back to it, if need be.

The issue I am wondering about is the number of pictureboxes. If you know about PPoint, you can add a new slide by pressing a button, but is there a way to just add a new picturebox by pressing a button while the prog is running? Or maybe I don't need another picturebox, maybe I just need to have the prog temporarily save the current picture in the picture box, and just blank it when I press a button to add a new slide. What do you think, has anyone done something like that before? I don't want to save the "thumbnailed" picturebox contents, but would like to refer back to them while the lesson is going on.

Thanks!
Viewing all 21189 articles
Browse latest View live


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