Results 1 to 9 of 9

Thread: Strings and things.....

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Question

    I think i am right in this but i need some advice.

    If i wanted to store a string into a variable..would i use this in a part of my code too store it?

    Dim strName As String

    Private Sub_text1()
    Name = " "
    end sub

    Is the (" ") the correct way to store the string??

    I know this must be a very basic question to all of you..but the damn book i have never gets to the point of something..the author just rambles on and on..

    If someone could tell me of a good visual basic book that is straight to the point and very good for a beginner....i need a book that teaches...not a book on run-on sentances..
    thank you.

  2. #2
    Addicted Member JasonGS's Avatar
    Join Date
    May 2000
    Location
    California
    Posts
    155
    Quotes DO mean strings...
    Code:
    Dim myString As String
    myString = "I am the evil Sophtware!!!"
    
    ' $ means string; no Dim needed...
    ymString$ = "Yes, I meant to put ym instead of my!"
    
    ' This would show you your strings...
    MsgBox myString & vbCrLf & ymString$
    
    ' as opposed to non-strings...
    Dim myNumber As Integer
    myNumber = 1800

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Name is a used property of most objects (in this case Me.Name)
    and it is readonly so you will get an error.
    Either use of prefixes or careful use of names wont.

    Yeah strings can be stored in code, but also in control properties, but don't store binary data in textboxes.
    Also to have special characters you can use chr(asciinumber) vb constants (check up visual basic constants)
    Code:
     "HEre comes some characters" & chr(1) & chr(255) & chr(17) & " and here they end" & _
    vbcrlf & "That was a carriage return ""this is quoted"" & _
    vbtab & "that was a tab"

    [Edited by kedaman on 06-01-2000 at 11:08 AM]
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    Code:
    Option Explicit
    Dim strName As String
    Private Sub_text1()
    strName = " "
    end sub
    You should put option explicit at the front of your code, then it will give you hell if you have something undeclared,
    and use the same name for the string as the one you declARed, don't declard it strName and use the name "Name" cause it will not work.

  5. #5
    Lively Member
    Join Date
    Mar 2000
    Location
    Lowestoft
    Posts
    91
    I think that the web, such as this site will teach you a lot, as you have learnt already, ppl here do answer simple question for ya. The one book that i've got however is "Sams Teach Yourself VB in 21 Days" and i got a huge discount off it on amazon. That book and this site is what taught me everything i know....(err....well ) so have fun, and enjoy programming in m$'s brilliant language...CHOKE CHOKE.... lol
    Mag-Net's Home
    Visual Studio 6-Enterprise - SP4
    ICQ: 35519773
    Have Fun

  6. #6
    New Member
    Join Date
    Jun 2000
    Posts
    8

    Thumbs up

    I agree with Mag-Net, you will be able to learn many things from the combined eternal knowledge from the people you talk with in this cool place.
    ----------------------------------
    If all fails, there must be a VINFOC - Virus In Front Of Computer
    -- /\/\/C

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Wink

    Thanks everyone.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Question

    One more question, once i have stored the text into a string what code should i input into my command button to display the message into another text box?

    I have two text box's and one command button

    the first text box property name is "txtMessage" and the second text box's property name is "txtMessage1".
    I want to transfer the stored information that a user puts into "txtMessage" into "txtMessage1",when the user presses the command button.

    What code do i use?
    Thank you.

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    In the commandbutton Click event put
    Code:
    txtMessage1=txtMessage
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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