Register for your free account! | Forgot your password?

You last visited: Today at 01:35

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Learning VB

Discussion on Learning VB within the Conquer Online 2 forum part of the MMORPGs category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2006
Posts: 523
Received Thanks: 4
I am currently learning Visual Basic programming.

to learn, a friend taught me some things:
agreement window
Buttons to open other forms
and a simle 'dice' game.

though i wanted an highscore on the dice game and did this:

if form3.highscore.caption < form3.score.caption then
form3.highscore.caption = form3.score.caption
msgbox "new highscore!"
end if

however, this will result in 9 as the perfect score.
10, 11 and 12 are not higher according to the program (if you get it, it wont see that as highscore)

can anybody help me with this?
i can send the program itself or the source code if you need it.
ganoderma is offline  
Old 05/04/2007, 15:00   #2
 
elite*gold: 0
Join Date: Apr 2006
Posts: 13
Received Thanks: 1
i think this tread is off topic here ehh? its not about conquer online.
newn01 is offline  
Old 05/04/2007, 15:02   #3
 
elite*gold: 0
Join Date: Feb 2006
Posts: 523
Received Thanks: 4
well,
you might be right about that but there isnt any section for programming in general and i probably forget that i posted it anywhere else if i do.

EDIT//
here is a zip file of the dource and the program itself.


(dice game.exe is the program, the rest is the source for visual basic)
ganoderma is offline  
Old 05/04/2007, 15:31   #4
 
bone-you's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 1,491
Received Thanks: 536
What are you learning it for? Anything in particular or just to learn it? If you're just looking for a language to learn might I recommend c++? I never liked VB back when I took it in school. I'll take a look though. Basic syntaxes are the same and it's still just logic.

edit:
well I looked at it. It appears you're comparing strings and not numbers. You're also using a string class to work them. Try turning them into integers or something.. I forget what it is in vb. dim as int? or whatever it is :P It should work then.

edit2:
fixed it.

Form2:
add to function start_Click
Code:
    If &#40;Me.Highscore.Text = &#34;&#34;&#41; Then
      Me.Highscore.Text = &#34;0&#34;
    End If
to stopknop_Click - replace
Code:
    If &#40;CDbl&#40;Me.Highscore.Text&#41; &#60; CDbl&#40;Me.Score.Text&#41;&#41; Then
works fine.
bone-you is offline  
Old 05/04/2007, 15:57   #5
 
elite*gold: 0
Join Date: Feb 2006
Posts: 523
Received Thanks: 4
thanks
needed a little editing to VB language and my names but it works
ganoderma is offline  
Old 05/04/2007, 19:20   #6
 
elite*gold: 0
Join Date: Dec 2005
Posts: 10
Received Thanks: 0
Quote:
Originally posted by ganoderma@May 4 2007, 14:47
I am currently learning Visual Basic programming.

to learn, a friend taught me some things:
agreement window
Buttons to open other forms
and a simle 'dice' game.

though i wanted an highscore on the dice game and did this:

if form3.highscore.caption < form3.score.caption then
form3.highscore.caption = form3.score.caption
msgbox "new highscore!"
end if

however, this will result in 9 as the perfect score.
10, 11 and 12 are not higher according to the program (if you get it, it wont see that as highscore)

can anybody help me with this?
i can send the program itself or the source code if you need it.
The problem is that it's a string compare. It's like a dictionary...

The data type for the caption is a string, in a dictionary, you sort strings as such.


Ed
Edward
Edwardo <== misspelled, I know.

Anyhow, you would see that with this logic the sorting for numbers would be like:
1
11
15
19
2
21
25
3
35
etc...

So, you need to convert that string to a number and do a NUMERIC comparison, not a string comparison.
Convert a string to an integer with the Val() function.

if Val(form3.highscore.caption) < Val(form3.score.caption) then
form3.highscore.caption = form3.score.caption
msgbox "new highscore!"
end if

Good day.
booboohead is offline  
Reply


Similar Threads Similar Threads
Learning how to code?
12/04/2009 - Mabinogi - 6 Replies
Well there's no sticky for some guidance, yet people always seem to push other people to code it themselves. Is it really easy? How much time would it take me to learn it from scratch to do something as "simple" as metallurgy? And like what methods would be best for today? Or is this something that just happens to be a neat byproduct ability after taking a class in advanced computer programming or something?
c++ learning
10/31/2009 - Kal Online - 21 Replies
Hello all Can anyone be so kind teach me the basic programing for c++, i have a good idea how to bypass the r11 security but i cant make it because i dont know how to use c++ Helpers pm me Enjoy
Learning..little direction plz
06/17/2009 - Dekaron - 0 Replies
got the unpacker,ran it, have the data file, now what do i do to get it to run like an .exe so i can select it with the GG killer launcher?
Learning C++
03/15/2009 - CO2 Private Server - 11 Replies
I want to learn how to use this program ... if anyone know a site or a good video about that plz tell me .. Thanks And i use 2008 is it good?



All times are GMT +1. The time now is 01:35.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.