Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[vb.net] help\question

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
-Negative-
Expert Cheater
Reputation: 0

Joined: 12 Oct 2007
Posts: 142

PostPosted: Fri Jun 13, 2008 7:14 pm    Post subject: [vb.net] help\question Reply with quote

how to set anything value to - 0001, its fakin doing me 1. how to make something value 0001

IMPORTANT
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Fri Jun 13, 2008 8:16 pm    Post subject: Reply with quote

You cannot make the value 0001 but you can make the string to display the number 0001

do something like (pseudo C#)

Code:
if ( num == 0 ) { String s = "0000"; }
else if ( num < 10 ) { String s = "000" + Convert.ToString(num); }
else if ( num < 100 ) { String s = "00" + Convert.ToString(num); }
else if ( num < 1000 ) { String s = "0" + Convert.ToString(num); }
else { String s = Convert.ToString(num); }

_________________
Back to top
View user's profile Send private message
-Negative-
Expert Cheater
Reputation: 0

Joined: 12 Oct 2007
Posts: 142

PostPosted: Fri Jun 13, 2008 10:14 pm    Post subject: Reply with quote

useless =\
Back to top
View user's profile Send private message
Estx
Expert Cheater
Reputation: 0

Joined: 04 Mar 2008
Posts: 172

PostPosted: Sat Jun 14, 2008 1:43 am    Post subject: Reply with quote

If you want it as a string: Integer.ToString("0000")

E.g.
Code:
Dim tInt As Integer
tInt.ToString("0000")

or
Code:
(10).ToString("0000")
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Jun 14, 2008 1:47 am    Post subject: Reply with quote

You could always do (C#):

Code:
string sNumber = iNumber.ToString().PadLeft(4, '0');


The first parameter is the total number of chars, and the second parameter is the padding character.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Estx
Expert Cheater
Reputation: 0

Joined: 04 Mar 2008
Posts: 172

PostPosted: Sat Jun 14, 2008 2:13 am    Post subject: Reply with quote

samuri25404 wrote:
You could always do (C#):

Code:
string sNumber = iNumber.ToString().PadLeft(4, '0');


The first parameter is the total number of chars, and the second parameter is the padding character.


Never thought of that, unique. Good idea, but probably better just to perform the padding in the format provider string as I suggested. Mind you, it's really just coding preference in that matter. No performance or rendering difference.
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Sat Jun 14, 2008 2:31 am    Post subject: Reply with quote

Yeah, I learned that early, when my dad showed me some string manipulation stuff (like Trim, Pad, etc.. you can find all that with "myString." and the intellisense will pick it up). I usually don't like to mess around with the formatting, but it's useful with Hexadecimal. Razz
_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites