Results 1 to 4 of 4

Thread: Format()

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303
    Is there a way to format with a variable of a certain
    format? What I am trying to say is that I have a column
    heading "My Title" which I read from the database, but when I print or format the value of this column, I would like to be able to use the same number of chars/length.

    So if my_heading is 8 chars long, I would like to
    format my_value such as format(my_value,8 of "@@@@@@@@")
    as well.

    Here is a sample code:

    Private Sub Command1_Click()
    Dim my_heading As String
    Dim my_value As String

    my_heading = "My Title" 'varies coz read from dbs
    my_value = "Short" 'varie from 1 to 8 chars

    Text1.Text = Format(my_value, "@@@@@@@@")

    ' is there a way to format with a variable "@@@@@@@@"?
    ' something like format(myStr,n,"@")

    End Sub

    Thanks in advance for the help.


  2. #2
    Guest
    You could try:

    Format$(my_value, String$(8, "@"))

    Just substitute the '8' argument of String$() with a variable.

    Paul

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303

    Thanks, PWNettle. It works great!

    Thanks for your help, and have a nice
    ThanksGiving holiday.

  4. #4
    Guest
    You're welcome. You have a nice (and hopefully long) holiday weekend too!

    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width