vb5prgrmr 143 Posting Virtuoso

Use your friends (yahoo, google, ask, answers, bing) and search for ShellExecute API or ShellExecuteEx API with the key word vb6 to get some code that will work for you in VBA...

Good Luck

vb5prgrmr 143 Posting Virtuoso

No I cannot help you by giving you code but I can help you define your problem so you know what code to write!!!

Okay, you have two players and two sets of controls. So what you will need is two variables. One each for each player. Then you will need to set each variables value in the click event of one or the other set of controls. Meaning Variable one's value will be set with group one's controls and variable two's value will be set with the other group's controls.

something like this pseudo code...

in player1's rock button click event...
v1=1
or in player2's rock button click event...
v2 = 1
and so on for both in paper (v1/v2=2) and scissors (v1/v2=3)

Then of course you will need to evaluate who won the battle but instead of creating the same code in each players buttons click event, you would want to create a seperate procedure to do the evaluation and call it from each click event, which also means that player1 and player2 variables need to be declare in the general declaration section of the form so that they are visible throughout the form.

Okay, so the procedure you need to create could go something like this pseudo code...

if v1=v2 then
'tie
msgbox "Tie, try again!"
v1=0 'reset variables
v2=0
elseif v1=1 and v2=2 '1=rock, 2=paper
notify here
reset here

vb5prgrmr 143 Posting Virtuoso

Hmmm... The choice of game you have decided upon gives me great concern but after reading what you wrote I understand that this is more of an excercise for you than an actual project. So with that said, all you need to do is to build a decision tree that test the values of each players input to decide the winner...

Good Luck

vb5prgrmr 143 Posting Virtuoso
Dim MyArray() As String, MyString As String
MyArray = Split("JK-501-3556-25-A-03#C", "-")
MyString = MyArray(0) & "-" & MyArray(1) & "-" & MyArray(2) & MyArray(3) & "-" & MyArray(4) & "-" & MyArray(5)
MsgBox MyString

Good Luck

vb5prgrmr 143 Posting Virtuoso

Instead of using the select case there OP and Andre, how about the Chr function...

?Chr(101)
e

Good Luck

vb5prgrmr 143 Posting Virtuoso

Yes it is possible, but not quite as easy.

If you know how many dimensions there are to begin with, you can do it like so...

Dim MyArray(1 To 25, 1 To 2) As String 'or could be 0 to 24, 0 to 1

MyArray(1, 0) = "UserName1"
MyArray(1, 1) = "RealName1"
'...
MyArray(25, 0) = "UserName25"
MyArray(25, 1) = "RealName25"

Or you could create your own UDT (User Defined Type)...

Option Explicit

Private Type MyUserType
  UserName As String
  RealName As String
End Type

Dim MyUser(1 To 25) As MyUserType

Private Sub Form_Load()
MyUser(1).UserName = "UserName1"
MyUser(1).RealName = "RealName1"
'...
MyUser(25).UserName = "UserName25"
MyUser(25).RealName = "RealName25"

End Sub

Good Luck

vb5prgrmr 143 Posting Virtuoso

Kin and Abu are talking about using the intrinsic timer control and not the SetTimeEvent API. Also, their values of 1000 to set its interval property, well it only equals 1 second. If you want one minute like you originally said, you will need to set its interval to 60000...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Shipra, did you follow the link in the post before yours and did you follow the links in that thread? Should be well over 100 different ideast between those two...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Well you need to error check for empty text boxes and if = to vbnullstring then textbox.text = "0.00"...

I forget, is column zero based or 1 based???

Good Luck

vb5prgrmr 143 Posting Virtuoso

Andre, if you look at our codes... they are almost the same :) Just mine does it with one line...

Now lets talk about the differences between your code and mine...

First up, the help file information...

Val Function


Returns the numbers contained in a string as a numeric value of appropriate type.

Syntax

Val(string)

The required string argument is any valid string expression.

Remarks

The Val function stops reading the string at the first character it can't recognize as part of a number. Symbols and characters that are often considered parts of numeric values, such as dollar signs and commas, are not recognized. However, the function recognizes the radix prefixes &O (for octal) and &H (for hexadecimal). Blanks, tabs, and linefeed characters are stripped from the argument.

The following returns the value 1615198:

Val(" 1615 198th Street N.E.")

In the code below, Val returns the decimal value -1 for the hexadecimal value shown:

Val("&HFFFF")

Note The Val function recognizes only the period (.) as a valid decimal separator. When different decimal separators are used, as in international applications, use CDbl instead to convert a string to a number.

So what does this mean???

It means that the OP's values of 1,250.00 + 3,500.00 + 2,100.00 would result in an answer of 6.00 instead of 6,850.00 but lets check to make sure...

Standard exe project, add 4 text boxes (Text1-Text4)... add code...

Option Explicit

Private Sub Form_Load()
Text1.Move 30, 30, 1500, 315
Text2.Move …
vb5prgrmr 143 Posting Virtuoso

Try...

Text4.Text = Format(CDbl(Text1.Text) + CDbl(Text2.Text) + CDbl(Text3.Text), "#,#.00")

Good Luck

vb5prgrmr 143 Posting Virtuoso

Follow the two links in the last post of this thread http://www.daniweb.com/forums/thread293210.html

Good Luck

vb5prgrmr 143 Posting Virtuoso

As I said, I don't see where you set tatts = to anything. In VB6.0, you can turn all of your text boxes into an array of controls and I mention this because that looks like what you are doing. In VBA and VB you could do something like...

Dim C() As Control
Redim C(0) As Control
Set C(0) = Text1
ReDim Preserve C(1) As Control
Set C(1) = Text2
'and so on

and it is this, that I do not see you do. I don't see where you set tatts = control... thus I believe your error...

Good Luck

vb5prgrmr 143 Posting Virtuoso

First off, UserForm1 denotes that you are using VBA and NOT vb6.0 so in the future you might want to search out VBA forums...

Second off, you could use a loop or two to cut down on the amount of code you have...


I have a few more comments but will leave them to those that are more experienced with VBA but I will say that I did not see where you set the variable Tatts equal to the controls it is to be associated with...


Good Luck

vb5prgrmr 143 Posting Virtuoso

Time to use your new best friends... and I'm talking about yahoo, google, ask, answers, and bing. These various search engines can find you so much example code, you could not shake a stick at it even if you did have all day. So what you need to search for is vb6 drag and drop tutorial. Why vb6 as part of your search you ask, well it is so that you can filter out some of the vb.net examples that are out there because vb6 and vb.net are two different animals. You could also use -.net to filter out even more but some sites have both classic vb6.0 examples and vb.net examples and doing -.net will remove those sites from your results, which might be a bad thing. Also, another site to search for example code is http://www.planet-source-code.com

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, so you have created the ODBC DSN on the target computer and have tested it and it works... So that means that the required drivers are on the machine for it to work... It is pointed correctly to the datasource...

Okay, beyond saying that you need to create an install package and not just copy over your exe,... I'm out of ideas as it sound like you have done everthing right...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Time to use your friends (yahoo, google, ask, answers, bing) to search for vb6 ado tutorial or look at the pinned threads of this forum...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Did you test the ODBC DSN? Did you name it correctly? I mean exactly the same name as there may be a space in the name...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Check out the DateDiff function for testing the date.

Use an Update Statement to increase the value by one or to set the field to the correct value.

Flash is not VB so I couldn't tell you. Hopefully someone can come along and give you an answer...

Good Luck

vb5prgrmr 143 Posting Virtuoso

If you create a ODBC DSN for your connection on your dev machine, you must create it on the target machine...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Connections are expensive, meaning in time and resources. Depending upon the system you are creating and the database you are using you may want to open the connection when the program starts and close the connection when the program ends, which is the easiest way in which to do things. Then when it comes to recordsets, you only keep them open for as long as you need them as they are expensive in their own right and can be even more expensive than a connection object...

Also, you use the pretty much the same syntax in closing a connection as you do with a recordset...

adoRs00.Close
Set adoRs00 = Nothing
adoCn00.Close
Set adoCn00 = Nothing

Good Luck

vb5prgrmr 143 Posting Virtuoso

This question has been asked before in many a forum and if you use your friends (yahoo, google, ask, answers, bing) to search for vb6 ideas, or vb6 project ideas, you should find a few results with lots of answers. In fact, if you search this forum you will see/find a couple of threads where this question has been ask and answered before...

Good Luck

PoisonedHeart commented: Thank you very much!! +1
vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

See http://www.connectionstrings.com just in case...

and I see that you are using ???? Data Source as in an ODBC DSN? Did you create the ODBC DSN on the other computer?

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, it sounds like you have designed a DR on one machine (Computer1) and now are trying to use it from a second machine (Computer2). Which means, it could be as simple as accidently hard coding the path to the database and since you are on another computer, that path is incorrect. Make sure you are specifying the correct path...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Well, what the error is telling you is that the connection object (DB) is not connected to the database, which could mean that the sub connectDB has not been called, and I can see where you have commented it out...

Step through your code to make sure you have opened it, and have not accidently close it...

Good Luck

vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

You need to add a reference to the Microsoft Scripting Runtime...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Then if your problem is solved, please mark you thread as solved and give any posts that were helpful to you a positive rating if you think that post deserves it...

Good Luck

vb5prgrmr 143 Posting Virtuoso

GoTo http://www.rentacoder.com or http://www.odesk.com and put it up for bid...

Good Luck

vb5prgrmr 143 Posting Virtuoso

That is because the rs.fields("fieldname") = picture1.picture is only saving a long integer to the database that at one time pointed to a memory location where the picture itself was stored. Use debasisdas links above andreret's post or see these...

save http://www.vbforums.com/showthread.php?t=335207
retrieve http://www.vbforums.com/showthread.php?t=346752

and here is a post with a link to a zip that allows you to retrieve a picture from a database without having to go to disk...

http://www.vbforums.com/showpost.php?p=2975462&postcount=35

Good Luck

vb5prgrmr 143 Posting Virtuoso

Adobe as a windows print to pdf print driver that you can download, install, and print to just as you would a regular printer and I believe, if I remember correctly, that you can use an INI file to specify name and directory settings...

Good Luck

vb5prgrmr 143 Posting Virtuoso

You need to look up the For Loop structure in help and or your book...

For VariableName = 1 To 6
  'do search here (use if statement)
Next VariableName

Good Luck

vb5prgrmr 143 Posting Virtuoso
Option Explicit

Private Sub Form_Load()
Picture1.AutoRedraw = True
End Sub

Don't turn it on and off like you are doing as it will disappear...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Set autoredraw=true...

Good Luck

vb5prgrmr 143 Posting Virtuoso
vb5prgrmr 143 Posting Virtuoso

Not having used that control before I don't know what to tell you but I have plotted data before using line, circle, and pset methods of a picture box and while this is probably a bit harder to do than using a control, it does give you the ultimate control...

Just a thought

Good Luck

vb5prgrmr 143 Posting Virtuoso

Andre, I think you had better check the value of the picture property because If I remember correctly, it is just a handle to a memory location, so in short, you will be saving a long value to the database and not the bits of the picture...

Good Luck

vb5prgrmr 143 Posting Virtuoso

The way you have it now, it will delete all settings in the section when you do your change and if you only have one, then it will work, but if you have multiple, then it could cause some problems.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Using ADO? Know ADO? Use friends (yahoo, google, ask, answers, bing) to search for vb6 ado tutorial...

strSQL = "SELECT [std name], [roll no], marks, category, FROM tablename WHERE [roll no] = " & Text1.Text & " AND marks >=" & somevalue

Now, if roll no is a text field you will need to do...
] '" & Text1.Text & "' AND

see the single ticks (') ? Same goes for marks but marks should be a numeric field.


Future hint for you. If you have M$ Access, you can create a dummy representative database in it to represent neary any kind of database. Fill it will some dummy data and then use the query designer to create your SQL statements. When in the designer, and you have finally figured out that you are getting the right information, you can goto view>SQL and with very little changes to that SQL statement, you can drop it right in to your program...

Good Luck

vb5prgrmr 143 Posting Virtuoso

Okay, where does your code startup? Sub Main? Form1? Well wherever it does, you can clean your form load up to something as simple as...

Option Explicit

Public Sub Form_Load()

On Error GoTo Form_LoadError

Dim SplashSetting As String

SplashSetting = GetSetting("ProjectName", "Startup", "ShowSplash", "T") 'T/F

If SplashSetting = "T" Then
  
  Me.Visible = True 'force this form to become visible
  formSplash.Show vbModal, Me 'show splash screen modally/vbModeless=default
  
End If

Exit Sub
Form_LoadError:

MsgBox "Form1.Form_Load " & Err.Number & ":" & Err.Description 'for debug and beta

End Sub

Then the rest of that code can go into your splash screen form load and form unload.

As for when your program is installed, the savesetting will not have been executed yet so the setting retrieved by the getsetting function will be the default value as I have shown in my little snippet. As for allowing the user to be able to change the splash screen value, you could add that to the options form (formOptions) of your program.

Good Luck

vb5prgrmr 143 Posting Virtuoso

See the SQL documentation for the commands, then issue them from VB via a connection object.

Good Luck

vb5prgrmr 143 Posting Virtuoso

Yes, by issuing the correct commands...

Good Luck

vb5prgrmr 143 Posting Virtuoso

reread that 3rd sentence...

vb5prgrmr 143 Posting Virtuoso

Restrict the user from entering those wildcard characters that you need to look up in M$ Access's help files in the keypress event, which I know you have seen before if you have been reading this forum...)

Good Luck

vb5prgrmr 143 Posting Virtuoso

Register the dll under the admin account and then right click>properties and give users of the system the rights needed and I think your problems will go away...

Good Luck

vb5prgrmr 143 Posting Virtuoso

[yoda voice]over complicate things, you do[/yoda voice]

Okay, well maybe not, but using the move method to navigate is your problem...(1+1=2 so move 2 will skip a record...)

You should use the movefirst, moveprevious, movenext, and movelast properties and things will be a lot easier for you (but keep the counter variable, add a recordcount variable for testing if you wish, and things should work out)...

Good Luck

vb5prgrmr 143 Posting Virtuoso

You might be able to use the "display" property??? "Format" Property??? of the field in question (i.e. table design view or the property of the textbox itself...). Can't quite remember as I don't normally work in VBA...

Good Luck

vb5prgrmr 143 Posting Virtuoso

I understand that,... that some teachers are lacking. My teacher published her own book that was only an inch thick that we had to buy for the class. Talking about conflicts of interest..., But while it did cover a lot of different topics, it did not go into much detail with explanations, so I had to buy my own book that was published by Que and it showed me the things I wanted to know...

Now, as for collision detection, there are a couple of different ways in which to accomplish what you want. There are a couple of different methods using the api but unless you really want to delve into it, you don't have to...

Okay, you have an object that has four properties. Left, Top, Width, Height, so we will start with checking collision with the borders of the form...

'here are the two obvious and easy detections...
If Object.Left <= 0 Then
  'we have collided with the left side of the form
ElseIf Object.Top = <= 0 Then
  'we have collided with the top edge of the form
  'next up is some simple math...
ElseIf (Object.Left + Object.Width) >= Me.ScaleWidth Then
  'collision with the right of the form
ElseIf (Object.Top + Object.Height) >= Me.ScaleHeight Then
  'collision with the bottom of the form
End If

Now, when it comes to decting two objects colliding, well this is where it can get interesting and quite complicated. So complicated in fact, you may want to write …

vb5prgrmr 143 Posting Virtuoso

Both versions have been out of support for some time now... I.E. .NET's arrival! But one can still find legal copies at ebay, or at nextag.com for both pro and ent versions of both VB and VS