Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2004

Tip: Looking for answers? Try searching our database.

Data types.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tom - 29 Apr 2004 09:12 GMT
Hello,

I have TextBox1 with this Value = 57.7
I need do something like this

MyNewVar = CDbl(TextBox1) .... but this is Type mismatch error 13

I need transform text value to number value.

Thanks Tom
Tom - 29 Apr 2004 09:16 GMT
I found the problem.
I need transform 57.7 to 57,7

> Hello,
>
[quoted text clipped - 6 lines]
>
> Thanks Tom
Dave Hawley - 29 Apr 2004 09:39 GMT
Hi Tom

No need to convert it. Simply use

MyNewVar Textbox1.Value
Tom - 29 Apr 2004 10:05 GMT
Yes but after this it will be String, String is using for text, I need
Double or Single.

Tomas

> Hi Tom
>
[quoted text clipped - 5 lines]
> Excel Templates, Training, Add-ins & Business Software Galore!
> Free Excel Forum http://www.ozgrid.com/forum ***
Dave Hawley - 29 Apr 2004 10:51 GMT
No it wont. Not if the Textbox has a number and you use .Value

Unless you have dimmensioned MyNewVar as a String
Tom - 29 Apr 2004 10:59 GMT
I tried this:

rem this is part which start after click on OK button in my Form

   MyVar = TextBox.Value
   MsgBox TypeName(MyVar)

and its String

> No it wont. Not if the Textbox has a number and you use .Value
>
[quoted text clipped - 3 lines]
> Excel Templates, Training, Add-ins & Business Software Galore!
> Free Excel Forum http://www.ozgrid.com/forum ***
Tom - 29 Apr 2004 10:51 GMT
This is big problem. for example when I want do tihs in Forms:

TextBox1 = 23
TextBox2 = 100

If TextBox1 > TextBox2 Then
   MsgBox "YES"
End If

Program said YES. And same problem I hve in another parts in my program.

> Yes but after this it will be String, String is using for text, I need
> Double or Single.
[quoted text clipped - 10 lines]
> > Excel Templates, Training, Add-ins & Business Software Galore!
> > Free Excel Forum http://www.ozgrid.com/forum ***
Dave Hawley - 29 Apr 2004 10:57 GMT
Tom. The default for a TextBox is Text. Simply use;

TextBox1.Value

NOT

Textbox1
or
Textbox1.Text
Tom - 29 Apr 2004 11:09 GMT
I found this....I was supid

I used Double but I have to use Currency so:

MyNewVar =  CCur(Text.Box)

its enough for me, now everything works like I need

Thanks

> Tom. The default for a TextBox is Text. Simply use;
>
[quoted text clipped - 9 lines]
> Excel Templates, Training, Add-ins & Business Software Galore!
> Free Excel Forum http://www.ozgrid.com/forum ***
dave - 29 Apr 2004 11:20 GMT
Dim myVar As Double

Will fix that. I cannot see any point in passing a Text number to a
variant, then converting it after. It's double handling.
Tom - 29 Apr 2004 12:19 GMT
I use it becase I give some data to TextBox for look in my Form and then I
take this data and put them to Worksheet.

> Dim myVar As Double
>
[quoted text clipped - 4 lines]
> Excel Templates, Training, Add-ins & Business Software Galore!
> Free Excel Forum http://www.ozgrid.com/forum ***
Tom - 29 Apr 2004 12:42 GMT
No, it worked now is same problem...Type mismatch

Someone make game of me.

> I found this....I was supid
>
[quoted text clipped - 19 lines]
> > Excel Templates, Training, Add-ins & Business Software Galore!
> > Free Excel Forum http://www.ozgrid.com/forum ***
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.