Visual Basic. Question

UltimaGeckoUltimaGecko hates endnotes Join Date: 2003-05-14 Member: 16320Members
<div class="IPBDescription">...at least it's not C++</div> Yes, object oriented programming, yay, eh?


1.
Well, it's kindof an off the wall question, but could someone give me the syntax (or a site with tutorials) about how to make a program that can save and load files (even just from .txt files, just need to save and load integers).

[I did at one time know how to do this - but I semi-learned it on my own, now it's forgotten]

2.
Also, I remember you can get a weird structure of variables from modules (maybe you can use it elsewhere, too). I can't remember how to do it either.

Mainvariable.subclass.sub-subclass.etc
ex. Player.Attribute.Strength = 44

It'll be kind of annoying to go back to the strPlayerStrength = 44 again, when this is simpler and more fluid once I remember how to declare/use it. Maybe a module declaration and use tutorial would be better.


...I know C++ would be more efficient, but unfortunately, I'm not in any programming classes (oh no, programming for fun - 3rd sign of mental instability! <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html//emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo--> ), and all I've got is a VB compiler.

(The game I'm planning has an easier structure with VB really anyway - although a C++ compiler <i>would</i> be awesome - but alas, I'm poor]

Comments

  • OttoDestructOttoDestruct Join Date: 2002-11-08 Member: 7790Members
    Dev C++ is free.

    On topic: I dont know VB.
  • SandrockSandrock Join Date: 2002-12-16 Member: 10905Members, Constellation, Reinforced - Shadow
    I cant remember the saving to text off hand, but for the other one, you need something called a TYPE.

    For example,
    <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->
    Type Player
          Name As String
          HP As Integer
          MP As Integer
          EXP As Long
    End Type
    <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    Then to reference it, it'd be like
    <!--QuoteBegin--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> </td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->
    Dim Player1 as Player

    Player1.Name = "UltimaGecko"
    Player1.HP = 500
    <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    You get the idea
  • UltimaGeckoUltimaGecko hates endnotes Join Date: 2003-05-14 Member: 16320Members
    Woot, that's very helpful.
    Just to make sure now, if I declare something Public in a module I can use it in any of the forms for a project, right? (not that that's actually related)


    [where's that stupid option that puts option explicit into every new code box...]
  • SandrockSandrock Join Date: 2002-12-16 Member: 10905Members, Constellation, Reinforced - Shadow
    <!--QuoteBegin-UltimaGecko+May 7 2004, 02:02 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (UltimaGecko @ May 7 2004, 02:02 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Just to make sure now, if I declare something Public in a module I can use it in any of the forms for a project, right? <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd-->
    Correct
Sign In or Register to comment.