Tracker
 ASP PHP JavaScripts MySQL MS Access MSSQL VISUAL BASIC Subjects/Titles Post Text/Content
HOME    TRACKER    Visual Basic

# Number Being Too Long?

## Hi just a quick post...The problem is I have to number im wanting to add to another number, which is easy enuff, however im now stuck because my numbers are too long?? e.g. 2151360000 , it keeps putting a # at the end and gives my an over flow error.

45 Number Long Variable
im setting up a method to use as many tiles as you want but each tile is represented by 3 numbers... so you can imagin how long each line of tiles gets....with 15 tiles in each line...

this is what im doing

first i set the mapline

Code:
mapline(0) = "101101101101101101101101101101101101101101101"

then i read each tile in there by reading that line by three's...
after it reads the 3 numbers from that tile say "101" then it assigns the 3 numbers to 3 varibes X = 1, Y = 0 , B = 1 those are pretty much the x and y and Block of that tile in my picture of tiles... if you are wondering the block is a batch of 7 by 9 tiles below the first batch "0"

now i need to find out how to store the mapline(0) i tryed as string.. but that gives me some mismatch errors later... i have tryed double but that ant right eaither... so if anybody can find out how to mabye convert a string varible to a long or integer varible then please let me know... because by the time it gets down to storing the number for that tile its only 3 numbers but if i can find some way to store the mapline that can still be used to save part of it as a intager or long then that would be great...

How, Long 60 Number Calc?
I have tryed 3 ways of getting a calculator to accept 60 numbers, but they all come up with the wrong answer. Can any one please help me find a way of producing a 60 charactor calculator that works. Ive got the basics done its just how do i make it accept 60 charactors without going into the expinetial.
Thanks

Long Number Conversion
I was wondering if anyone knew of a site with code on converting to other number systems, or knew the code. I need to know how to convert from decimal to hex and binary, from binary to hex and decimal, and from hex to binary and decimal. The only problem is that I am not allowed to use the shortcut functions in vb, I need to write out the actual code to do the conversion, and am completely lost. If anyone could help, please respond, would mean a great deal to me.

How To Get Date From Long Number
Hi

This is very urgent i have
if any one know about convert long number into date format
i have souce i java script but i want to convert into vb 6.0 code
1108508090 this is input number

var l =1108508090 *1000+86400;
var aDate = l; // miliseconds Since 1970;
dd = theDate.getDate();
mm = theDate.getMonth()+1; // 0 based
yy = theDate.getYear();
if (yy < 1000) yy +=1900; // Y2K fix

plz help me

Long Random Number Generation
One important factor to keep in mind when generating random numbers - as BillSoo noted in his random number tutorial, the random number generator in VB is precise to approximately 1 in 16 million. This means that if you are generating a random number larger than this, you will start getting quantum effects - that is to say, the total quantity of individual random numbers is still limited to 16 million (2^24); These discrete numbers will distributed within the larger range you've specified. Some numbers will never be generated. If you were trying to get a random number in a range from 0 to 32 million (2^25,) for instance, fully half the possible numbers could never be generated. And, the larger the number, the worse this ratio gets. In fact, when you try to obtain random numbers in a range that approach the limits of the long data type (2^31 bits,) less than one percent (1 of every 128) of the possible random numbers can ever be generated with the rnd function!

A workaround for generating a long random number is to generate 2 individual integer-sized random numbers, and shift one of these to the left 16 bits, then OR (add) the two random integers together. In order to avoid negative long numbers, make sure that the left-most (high-order) random number is limited to 32767 or less, whereas the low-order (unsigned) integer could be any value up to 65535. Since VB doesn't support an unsigned integer data type, You would actually use longs instead.
Code:
Public Function dblRnd() As Double

Const Power15 As Long = 2 ^ 15
Const Power16 As Long = 2 ^ 16
Const LongMax As Long = 2 ^ 31 - 1

Dim lngValHi As Long
Dim lngValLo As Long

lngValHi = Int(Rnd * Power15)
lngValLo = Int(Rnd * Power16)

dblRnd = CDbl(lngValHi * Power16 Or lngValLo) / LongMax

End Function
The dblRnd function returns a random number based on the full size of a long variable type, and uses the Double type, which is more than precise enough (15 significant digits in the mantissa) to contain the full range of a long variable. It is used in exactly the same fashion as Rnd, including the use of Randomize (only once in the life of the app) to seed the random number generator.

If, for some reason, you needed to generate even larger random numbers, (as numbers, not strings) this same approach could be extended to 48 bits, by making three Rnd calls, and placing the highest order word into a double instead of a long, then adding the middle order (shifted) and low order words. I will not present code for this approach, as the useage would be very limited, and the speed of the function would suffer.

The form snapshot below is a histogram of data generated using the new dblRnd function. In this case, the app was set to generate 10 million samples of random numbers in a range of zero to one billion (10^9) - 1. The results were accumulated in a 1000 element histogram. As is readily apparent, there appears to be no obvious statistical data skew associated with using the function. The histogram is flat, displaying minor statistical variability.

-

Keeping The Format Of A Long Number....
Hi all,

I've got an Excel spreadsheet that holds numbers 17 digits long (no decimal). It's formatted in Excel to show fully, but when I try to import it to VB (FlexGrid), it ends up showing in Scientific Notation and I can't seem to convert it out. How can I make it show the full number and not in S.N. format?

Thanks!

String Representing A Number To Long Value
Is there an easy way to convert a string that represents the spelling of a number into a long value?

Ex. "one thousand six hundred fifty three" ==> 1653

Thanks!

API For String &lt;-&gt; Number(long, Int, Float)
Is there an API for these string conversions? I'm trying to use only Kernel32.dll library for this DLL

Long Number Data Type
Hey all (again, sorry for all the questions ^^;; )

I'm just wondering if there's a data type or if one can be made for storing very long numbers, but being able to perform mathmatical calculations on them? (i.e. not a string).

I want to use the Rnd function to generate a 20-digit number, e.g. 40229603967719402863. I can't store it int/long/etc as it's too long, I can store it in Double but then it makes it a floating point number.

Soo.. Any way to generate a number of this size and have it display the full value? I'm trying to generate a unique ID, you see

Extract Long Number Value From String
I tried Val, but that returns a Double... which gives me 0 when it should be 0.125. What function can I use that will return all of the numeric part of the string?

For example:
String = "Best time: 0.125 seconds"
Val = 0
I want = 0.125

Problem Inserting Long Number In XL File
When I insert a long no in a xl file
ie for example

22222222222222222222

i am getting like this in xl can somebody help me out of this.I want it in the same format.

2.22222E+19

This is in VB

*Resolved* Date(String) And Number(Long) Format
How can I pass a date and number(long) in this format using VB code :

(1, '07/02/2003')

VB Code:
dim field_a as Longdim field_b as String ( " & field_a & "," & " & " ' field_b ' " & " )

I need to pass the date in the above format with a single quotes.I tried above code ;but at runtime,it says :Syntax Error"

[Oracle][ODBC][Ora]ORA-01461: Cannot Bind A LONG Value For Insert Into A Long Column
Using the Oracle in OraHome92 version 9.002 ODBC driver in visua basic I receive the message "[Oracle][ODBC][Ora]ORA-01461 cannot bind a LONG value for insert into a long column" whe updating a large table a table with 59 columns. The proble seems to be related the number of columns being updated or th size of the data. I am using a recordset object to perform th update. If I limit the number of columns I update, the updat works successfully. On smaller tables, the update work successfully.

Make A String 8 Long 33 Characters Long By Adding Spaces
Say I had a string "hellothere" and I wanted to make it 33 characters long by adding spaces at the beginning. I know there is some vb function for doing this, but I for got what its called

Long Long String For Mail Body!!
Do anyone know how to put the lyrics below into the "My Text Line"

Dim FindOutlook, Mailname, MakeMessage

Set FindOutlook = CreateObject("Outlook.Application")
Set MailName = FindOutlook.GetNameSpace("MAPI")

Set MakeMessage = FindOutlook.CreateItem(0)
MakeMessage.Subject = "My Subject Line"
MakeMessage.Body = "My Text Line"
MakeMessage.Send

MailName.Logoff

------------------------------------------------------------------------------------------
This is the lyrics that you ask for:-

Donna negai naraba kanaerarenai to iu noka?
Yo no naka de sae shinjiteta koro
Yume wa mugen ni aru, sono subete wo utagai mo sezu
Mitasarete ita, yurusarete ita

Hitotsu hitotsu mono wo shireba
Kodomo no mama dewa ikite yukenai to

Kawari yuku hito wo tooku ni mite wa
Jidai no ibuki ni mi wo sarasu

Koko dewa nai dokoka eto mune wo kogasu yo
Mujaki na toki wo sugi, ima daremo ga sen****achi
Nido towa nai kaze no kaori, ato ikutsumo no
Tobira wo tataite kono itami wo yawarageru

Yoku miteta keshiki tatoeba furui koi no uta wo
Hakifurushi no kutsu dokomade toberuka kyousou ****a
Sonna nakama to betsu no to ni tsuku

Michi ni saita hana no you ni
Chikara no kagiri ni utai tsuzuketeru
Onaji kimochi de ite kureta nara
Aenai hibi mo sore mo mata...

Hakarazumo sou bokura wa koukai ni deta
Yuruginai tamashii ni minami muki no ho wo tatero
Kanashii koto bakari no yo urei no yoru niwa
Dareka no yuasashii ai no uta ni nemuru dake

Ai wo katarenai kuchibiru ni
Kodoku ni hoho yoseru koibito tachi
Kono basho ni todomaru riyuu nado nai sa
Kagayaki sura ari no mama no

Koko dewa nai dokoka eto mune wo kogasu yo
Mujaki na toki wo sugi, ima daremo ga sen****achi
Hakarazumo sou bokura wa koukai ni deta
Yuruginai tamashii ni minami muki no ho wo tatero
Kanashii koto bakari no yo urei no yoru niwa
Futari no negai wo kanaeraretara

Have No Fear, Razifhoe is Here.

CSng(Long) Or Long * 1
I have a function that takes a variable of the Single data type. I have a variable of the Long data type that I would like to pass to this function. I know of two simple ways to make this work:

Code:
SomeFunction(CSng(SomeLong))
or

Code:
SomeFunction(SomeLong * 1)

Both work, which is faster?

Convert An RGB Value To A Long, Or A Long To RGB
I thought that this might be helpful to someone...

VB Code:
'Convert RGB to LONG: LONG = B * 65536 + G * 256 + R 'Convert LONG to RGB: B = LONG 65536 G = (LONG - B * 65536) 256 R = LONG - B * 65536 - G * 256

Cheers...

Is There Any Built In Method To Convert Decimal Number To Binary Number In V.b 6.0
Hi everybody!

can u say whether any built in method is available to convert a given decimal number to binary number?

i can develope a user defined method for this. but i think it takes some extra time to execute... since i have to call this method repetedly...

thank you,
Regards:

Text1 Number &gt; Text2 Number Error After 2 Digis Use(solved)
Umm, this a weird error it I amtrying to compare two numbers in each box,

so it will be something like this

If text1 > text2 then
msgbox "too large"
End if

But the weird thing is after the number hit two digits lets say over 10 and up then I get errors, even if the number in text2 is larger this only happens after it goes over 10

weird is there a better wayt to compare number that is more reliable or do i need to add something to the code

Thanks

Retrieve Hard Disk Serial Number Using VB [Not Volume Number]
I need help in reading the Hard Disk Serial Number [Not the volume number] using VB. Currently I am using VB5.

I have found a site that has the program to read the serial number but it is written in C++.

Can anyone convert it to a DLL or has any other solution for it.

The site is http://www.winsim.com/

Thank you.

Random Percentage Subtracted From Whole Number Mixed With Exact Number From A DB. Oh My!
Hey all, I have a more of how to question I have some code but I do not think its worth posting. I have a need some help with some code that would take a number "11192" to repersent 4 parts of something, but they need to be random parts of the whole. Then once I have that number, I query a DB randomly to get numbers to to = the random 1/4 of the whole number.

so lets say I have a list of numbers like

4.25
6.1
5.5
7
8.95
ect..

so I have all these little exact numbers that need to match this exact random 1/4 of the whole number.
Does this make since??? I have been working on this for a while now and I am not sure if I am making since! lol

How To Find Hard Disk Model Number & Microprocesser Number?
How to find hard disk model number & microprocesser number.
Is there any API through which I can find out these numbers.

Convert A Number Strored As Text To A Number Automatically!
Hi!

it΄s possible convert a number strored as text to a number automatically,without lossing the non decimal number!!!?

thanks

Number Verses Auto Number - With An Add/Update Query.
Hi there,
I would like to use Number and NOT the normal AUTO NUMBER. But I have a mayor problem as always the same error message comes up and therefor I can't SAVE the data.

Would anybody be able to help.

Thanks aktell

Runtime error'-2147467259(80004005)':
Operation must use Updateable query.

Code:
Private Sub ctl_GButton4_Click()
'---
'--- SAVE.

With Cmd
.ActiveConnection = ConRost

Else
.CommandText = "sp_Edit_Rostering"
'--- Originaly used with Auto Number.
' .Parameters.Append cParam("@iBookingDate_ID", _
End If

'--- The first line I used as I like to use NO AUTO NUMBER, but use _
NUMBER as ID field.
SetText(Me.txt_BookingDate_ID.Text))
SetText(Me.txt_ClientID.Text))
SetText(Me.txt_NameRostClient.Text), 50)
SetText(Me.txt_CarerID.Text))
SetText(Me.txt_NameRostCarer1.Text), 50)
SetText(Me.txt_BookingTime_ID.Text))
.Execute
End With

Rs_Rostering.Requery

'--- Date for the grid.
Set Me.DataGrid1.DataSource = Rs_Rostering

End Sub

Private Sub GetValues()
With Me
.txt_BookingDate_ID.Text = _
GetText(Rs_Rostering.Fields("BookingDate_ID"))
.txt_ClientID.Text = GetText(Rs_Rostering.Fields("Client_ID"))
.txt_NameRostClient.Text = _
GetText(Rs_Rostering.Fields("ClientName"))
.txt_CarerID.Text = GetText(Rs_Rostering.Fields("Carer_ID"))
.txt_NameRostCarer1.Text = _
GetText(Rs_Rostering.Fields("CarerName"))
.txt_BookingTime_ID.Text = _
GetText(Rs_Rostering.Fields("BookingTime_ID"))
End With
End Sub

Code:

PARAMETERS [@iBookingDate_ID] Long, [@iClientID] Long, _
[@sClientName] Text ( 50 ), [@iCarerID] Long, [@sCarerName] _
Text ( 50 ), [@iBookingTime_ID] Long;
INSERT INTO tbl_June ( BookingDate_ID, Client_ID, ClientName, _
Carer_ID, CarerName, BookingTime_ID )
VALUES ([@iBookingDate_ID], [@iClientID], [@sClientName], _
[@iCarerID], [@sCarerName], [@iBookingTime_ID]);

[color=Red]sp_Edit_Rostering:[/COLOR]

PARAMETERS [@iBookingDate_ID] Long, [@iClientID] Long, _
[@sClientName] Text ( 255 ), [@iCarerID] Long, [@sCarerName] _
Text ( 255 ), [@iBookingTime_ID] Long;
UPDATE tbl_June Set tbl_June.Client_ID = [@iClientID], _
tbl_June.ClientName = [@sClientName], tbl_June.Carer_ID = _
[@iCarerID], tbl_June.CarerName = [@sCarerName], _
tbl_June.BookingTime_ID = [@iBookingTime_ID]
WHERE (((tbl_June.BookingDate_ID)=[@iBookingDate_ID]));

Convert To Number The Number Stored As Text In Excel
can anyone help me on how to convert the number stored as text in excel when i exported my recordset in excel

this is how i exported my recordset

How Do I Calculate The Number Of Times A Number Is Repeated Consecutively?
OK, I have some code set up to recieve a series of numbers from a user.
What I want is to be able to show the user how many times a number is repeated in a row (in the order entered). for example if they enter:

3 4 6 17 23 4 4 4 7 5 19

The longest period of consistent numbers was 4 and it was repeated 3 times.

how do I code this? I'm sure all I need is a counter and an if statement inside a while loop, which I already have.
I think I need something like:

repeatedNumber = 0
if previousNumber = number then
repeatedNumber = repeatedNumber + 1
endif

but how can I have VB know what the 'previous number2 was?

Please can someone help? I've spent sooo many hours trying to do this and my head's about to explode.

Change A Labels Number Regarding Text File Number
i was wondering how i can change a labels caption number regarding what number is in a file

i have a file with 10 numbers on one line (ie.0123456789) and i have 10 labels
label 1 to 10 from left to right, now i need these to change accordingly (ie label1.caption = character 1 (0), label2.caption = charater 2 (1) and so on)

can this be done

thankyou

Getting A String In Order From Lowest Number To Highest Number
Hi,

Say I have 3 numbers between 1 and 10 inclusive, none to be the same as the other:

Dim numbers_got As Boolean
Do

Randomize

a = Int(Rnd * 10) + 1
b = Int(Rnd * 10) + 1
c = Int(Rnd * 10) + 1

If a <> b Then
If a <> c Then
If b <> c Then

numbers_got = True

End If
End If
End If

Loop Until numbers_got = True

text1.text=

---------------------------

How can I get text1.text to print the numbers in ascending order? In reality I actually have about 15 numbers, so it would be a bit impractical to have loads of

If a<>b then
if a <>j then ....etc....

Thanks for any help.

Findind Line Number And Page Number In Word
I am Writing an application that will write the contents of a RTF on to a word doc. I will have to search through this word document for a list of words and then find out the line number at which the word appears and also the page number in which it occurs.

The problem i am facing is that word wraps the lines after a specified width where as I am searching for an end of line using vbcrlf. How can i retrive line by line just as the way it will appear in a word document.

Rama

Is This Number To Big For A Double????RESOLVED Found Negative Number In SQR
Below is the line from my code that gives me a run time error 5 Invalid prodeedure or argument. All the variables are as Double. The second line shows the values at the time of error using debug. Any thought as to the problem here.

CBEndLoad(CBLI) = Sqr(CBWindTension(CBLI) * CBTotalWidthIn(CBLI) ^ 2 _
/ (8 * CBDeflect(CBLI))) * (1 + 16 * (CBDeflect(CBLI) / _
CBTotalWidthIn(CBLI)) ^ 2)

CBEndLoad(CBLI) = Sqr(15.8919545884763 * 144 ^ 2 _
/ (8 * 107.6144542896)) * (1 + 16 * (107.6144542896 / _
144) ^ 2)

Edited by - alfarata on 10/17/2005 12:26:26 PM

Help!!how To Display Record Number Or Line Number In The Report??
hi friends,
i want to print record number(line number) in my data report which is not the part of the selected query.
how should i do this ?
is there any way?
and i am using nested query and not the stored procedure.

give reply as soon as possible..................

Number Verses Auto Number - With An Add/Update Query.
Hi there,
I would like to use Number and NOT the normal AUTO NUMBER. But I have a mayor problem as always the same error message comes up and therefor I can't SAVE the data.

Would anybody be able to help.

Thanks aktell

Runtime error'-2147467259(80004005)':
Operation must use Updateable query.

Code:
Private Sub ctl_GButton4_Click()
'---
'--- SAVE.

With Cmd
.ActiveConnection = ConRost

Else
.CommandText = "sp_Edit_Rostering"
'--- Originaly used with Auto Number.
'.Parameters.Append cParam("@iBookingDate_ID", _
End If

'--- The first line I used as I like to use NO AUTO NUMBER, but use _
NUMBER as ID field.
SetText(Me.txt_BookingDate_ID.Text))
SetText(Me.txt_ClientID.Text))
SetText(Me.txt_NameRostClient.Text), 50)
SetText(Me.txt_CarerID.Text))
SetText(Me.txt_NameRostCarer1.Text), 50)
SetText(Me.txt_BookingTime_ID.Text))
.Execute
End With

Rs_Rostering.Requery

'--- Date for the grid.
Set Me.DataGrid1.DataSource = Rs_Rostering

End Sub

Private Sub GetValues()
With Me
.txt_BookingDate_ID.Text = _
GetText(Rs_Rostering.Fields("BookingDate_ID"))
.txt_ClientID.Text = GetText(Rs_Rostering.Fields("Client_ID"))
.txt_NameRostClient.Text = _
GetText(Rs_Rostering.Fields("ClientName"))
.txt_CarerID.Text = GetText(Rs_Rostering.Fields("Carer_ID"))
.txt_NameRostCarer1.Text = _
GetText(Rs_Rostering.Fields("CarerName"))
.txt_BookingTime_ID.Text = _
GetText(Rs_Rostering.Fields("BookingTime_ID"))
End With
End Sub

Code:

PARAMETERS [@iBookingDate_ID] Long, [@iClientID] Long, _
[@sClientName] Text ( 50 ), [@iCarerID] Long, [@sCarerName] _
Text ( 50 ), [@iBookingTime_ID] Long;
INSERT INTO tbl_June ( BookingDate_ID, Client_ID, ClientName, _
Carer_ID, CarerName, BookingTime_ID )
VALUES ([@iBookingDate_ID], [@iClientID], [@sClientName], _
[@iCarerID], [@sCarerName], [@iBookingTime_ID]);

sp_Edit_Rostering:

PARAMETERS [@iBookingDate_ID] Long, [@iClientID] Long, _
[@sClientName] Text ( 255 ), [@iCarerID] Long, [@sCarerName] _
Text ( 255 ), [@iBookingTime_ID] Long;
UPDATE tbl_June Set tbl_June.Client_ID = [@iClientID], _
tbl_June.ClientName = [@sClientName], tbl_June.Carer_ID = _
[@iCarerID], tbl_June.CarerName = [@sCarerName], _
tbl_June.BookingTime_ID = [@iBookingTime_ID]
WHERE (((tbl_June.BookingDate_ID)=[@iBookingDate_ID]));

Making A Number Show Up In Excel As A Negative Number (value)
Ok I thought I had fixed my problem but I just made it look like it was right LOL

Code:
If arrRecords(n).string7 = 0 Then
xlWorkSheet.Cells(n + 1, 6).NumberFormat = "0.00"
arrRecords(n).string7 = 0#
Else
xlWorkSheet.Cells(n + 1, 6).NumberFormat = "-###,###,##0.00"
xlWorkSheet.Cells(n + 1, 6).Value = arrRecords(n).string7
End If

Ok when it writes to excel it looks like it is a negative number -100
However, when I click on the cell the value is 100.

So really is this part of my code is useless???
Code:xlWorkSheet.Cells(n + 1, 6).NumberFormat = "-###,###,##0.00"

how do i get the value to be a negative?

Edited by - epatterson78 on 12/8/2003 11:36:52 AM

Fit To X Number Of Pages Defined By Number Of Rows
Hi all,

I am looking for a way to set the number of pages a spreadsheet prints off as which will be determined by the number of rows.

I want to display 75 rows per page. So if I had 75 rows, it would fit to one page, if there were 76 lines then it would fit to two pages. 150 lines would be two pages and so on.

Is there any way to do this?

Below is the start of what I had been trying to do;

Code:
DocsNum = Range("D501").value + 7
PagesNum = DocsNum / 75

DocsNum just looks at a cell that defines how many documents there are and then adds 7 to it. That gives the total numbers of rows in the document (that need to be printed)

I then divided this by 75 and I am then thinking that I will need to round up, maybe?

Any help would be great

How To Divide Currency Value By A Number And Get A Number Result
Dear Friends!

I have a small question. I attached an Excel file which contains currency trading report for 4 currency pairs. It is required that I can divide those values(column B) by specific numbers to get pip value out of them....But simple division of those cells doesnt appear to work...giving a Value error. Like dividing (₯1,974,000.00) by 10..or SFr. 32'200.00 by 20... I wonder if there is a way to safely divide those cell by simple numbers(10,20...etc) to get raw numerical results. Any help will be hugely appreciated....

Coverting Cell With Number And Text To Number
Hello All,

I have a cell that contains "6.29 seconds", is there a way using VBA to pull out just the number and place it in another sheet.

Thanks

Andrew

A Fast Way To Check If A Number Is A Square Number?
Hi, I'm dealing with pretty big numbers (storing them in Decimal format) and I would like to know what the best way to check if the number is square or not. I could create an array of booleans which stores if each number is square or not but this is impractical as I would have to have the array contain about 100 thousand million million elements.

I thought I could just take the square root of a number and see if the square root was an integer or not. However this does not work with numbers such as:

139411375073318926

Which when stored as a Decimal gets rounded up to the nearest integer and so it appears to be a square number when it's not.

Is there a quick guarenteed way to test if a number is square or not?

Set Next Number Of Combo Box List According To The Number Pressed
hello
im trying to make a smart combo box that will loop through itself when KeyPress is activated and set the number that is pressed.

i have a combo box with years loaded in it ranging from 1930 to 2005. when the user will press 1 it will automaticly go to the first number starting with one wich is 1999, then if the user will press 8 it will go to 1899 and so on.

just for the info.......my combo box style is set to "2 - Dropdown List"

i have tried doing this myself but i dont see where im going with this , so maybe you can help me.

this is where im stuck

Code:
Private Sub cboYr_KeyPress(KeyAscii As Integer)
Dim i As Integer
Dim srch As Byte
If KeyAscii >= 48 And KeyAscii <= 57 Then
For i = 0 To cboYr.ListCount - 1
If KeyAscii = cboYr.List(i) Then cboYr.Text = cboYr.List(i)
Next i
For srch = 1 To 5
For i = 0 To cboYr.ListCount - 1
If cboYr.List(i) = KeyAscii Then
cboYr.SelStart (srch - 1)
End If
Next i
Next i
End If
End Sub

How Can I Determine That The Input Of A Checkbox Will Be A Number And Only A Number?
hi

let's assume that i have 2 textboxes named txt1 and txt2 and a label called lbl1.

i want to add the content of txt1 to the content of txt2 and the result will be shown in lbl1.

the code is :

lbl1.caption = txt1.text + txt2.text

this will work only if i type numbers in txt1 and txt2.

but how can i "lock" txt1 and txt2 so that they accept only numbers and not letters(e.g words)?

Number With Commas Divide By Regular Number?
if the user imputs 6,000,000,000 and in the code that would be divided by 7378750, it wont divide cuz of the ","commas. is there any way to tell it to ingnore the commas and treat 6,000,000,000 as a regular number???

Number Of Control On Form - Is There A Maximum Number ?
Is there a limit imposed by the VB6 IDE for the maximum number of controls which can be placed on a form ? Apparently these is - or is this a function of computer memory ?

regards

Entering Starting Number And Ending Number
is there a way to add the starting number and then add the ending number and have it put all of those numbers inbetween into a list box

like have a prompt saying

Enter starting number
A: 1
Enter Ending number
A: 150

then it would make a list
1
2
3
.
.
.
149
150

inside a list box. how would i do that

i ment list box

Edited by - demosthenes705 on 12/1/2004 11:34:18 AM

Change Positive Number To Negative Number
Hello All Member,

How to write Change Positive Number to Negative Number using VB code.
Example : a = NegativeNumber(90)
result ---> a = -90

I'm MeShto. (One of the world.)
Select * from vbcity where Member = 'MeShto';

SELECT [number] FROM [table] WHERE The Number NOT In [field]
Is there a way using SQL to return the first number that is not in a particular field? I approached this by looping through a range of numbers and doing a query for each one but this is painfully slow. Anybody have any ideas on how to do this faster?

Randomize - Next Number Bigger Than Previous Number
Hello, does anybody know how to get 10 random numbers between 0 and 1000, but every number has to be bigger than the previous one?

I know how to do a simple randomize and I can put it in a loop (For i = 0 To 9), but how do I make sure that the next number is always bigger than the previous one?

Thanks.

Code:
Option Explicit

Dim RandNum As Integer

Private Sub Command1_Click()
Randomize
RandNum = Int(Rnd * 1000) + 1
Debug.Print RandNum
End Sub

How Can I Convert A Decimal Number To A Binary Number?
How can I convert a decimal number to a binary number? Do you know if there's the function I can find in VB?

Best Regards,

Kevin Shen

Help Converting Long To Byte Array And Byte Array To Long
Here is the issue I have. When I try to convert a long to a byte array then convert it back i get funky results

Code: cByteToLng

Dim lValue As Long

lValue = Val("&H" _
& Right\$("0" & hex(cData(0)), 2) _
& Right\$("0" & hex(cData(1)), 2) _
& Right\$("0" & hex(cData(2)), 2) _
& Right\$("0" & hex(cData(3)), 2) _
& "&")

cByteToLng = lValue

Exit Function

Now when I call
Code:
Public Function cLngToByte(ByVal lng As Long) As Byte()
On Error GoTo ErrHandler
Dim ByteArray(0 To 3) As Byte

CopyMemory ByteArray(0), ByVal VarPtr(lng), Len(lng)
cLngToByte = ByteArray

Call cByteToLng(cLngToByte)

Exit Function
ErrHandler:
Err.Raise Err.Number, Err.Source, Err.Description
End Function

When I call the cLngToByte and then send the result immediatly to the cByteToLng i get -184549376 instead of 245 and i also get 184549376 instead of 594

Also I have a buffer of 2097152 bytes or 2MB is this also a problem?

Edited by - BooyaCS on 2/9/2006 1:45:07 PM

Random Number Without Repeating The Same Number