Solved

System Settings and textboxes

Posted on 1999-01-18
3
157 Views
Last Modified: 2010-05-03
if i do this command:
Str$ = text1.text
with the decimal numeric format of systems settings = "," it doesn't retrieve the right value.
How can i get it right ??
0
Comment
Question by:ttrigo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Accepted Solution

by:
rondeauj earned 50 total points
ID: 1469289
1) STR is a VB keyword

2) try this:

 dim tempstring as string
 tempstring = format(text1.text,"#####.##")


0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1469290
Even though Str is a VB Keyword you are allowed to Dim:
Dim Str$

Although I wouldn't recommend it precisely for that reason.

That aside, I do not understand what you are trying to do here:

Str$ = text1.text

I assume that text1 is a text box; in that case, the text property of text1 is a string type property anyway. So you're assigning the value of string text1.text to string Str$

The decimal numeric format of system settings doesn't come into the picture at all.

So, what exactly are you trying to do? Once I understand that, I will be able to sort out your problem for you.

Regards, etc,
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 1469291
Try this function.

'pstrDecimal is a string containing the string representation of your number
Public Function FormatDecimalSQL(ByVal pstrDecimal As String) As String
Const kSep as string = ","
Dim intPos As Integer
   
    intPos = InStr(1, pstrDecimal, kSep)
    If intPos = 0 And Len(pstrDecimal) > 0 Then
        FormatDecimalSQL = pstrDecimal
    ElseIf Len(pstrDecimal) = 0 Then
        FormatDecimalSQL = "0"
    Else
        FormatDecimalSQL = Mid$(pstrDecimal, 1, intPos - 1) & _
                           "." & _
                           Mid$(pstrDecimal, intPos + Len(kSep))
    End If
End Function

Normally,

0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question