CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2008
    Posts
    16

    Visual Studios.Net Program Question

    *NOTE: I am using Visual Studios.NET 8 Standard Edition*

    I am very new to using visual studios.net and just purchased about 3 days ago actually. I have very beginner skills in vb 6 and using the program for the language. The great thing is the way the program is set up its pretty easy to go from one to the other SO FAR. Obviously the only thing that gets in my way is the language.

    My question might be very easy and I think i have the answer myself actually but I want to make sure. I bought a book to program in VB.NET. Going threw the book there are curtain things I can't go along with from the book.

    First off declaring a "global variable" which i think is how its referred to in visual studios. Before in vb6 the code part of the program had a tab which let you switch from a small section of code to a particular object to a section which showed all the code for the program and objects together. In visual basic 6 to declare a variable which would be used for several things you would have to do it under "Option Explicit" I think it was called. On Visual Studios the book is telling me to do it under "Windows Form Designer generted code" which should load up automatically with a new project but it does not for me. My book says when you start a new project with a form and double click it the code should look like this :

    Public Class Form1
    Inherits System.Windows.Forms.Form

    + Windows Form Designer generated code

    Private Sub Form1_Load(ByVal sender As System.Object. _
    ByVal e As System.EventArgs) Handles MyBase.Load
    End Sub
    End Class


    but when i do it MINE reads the following:


    Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
    End Class

    I asume my book just is using a older version of the program then I am which is to bad because its a little difficult to follow.

    1.If this is true where would i declare a variable with a wide scope or a "global variable"?

    ^Thats my first question my next question is:

    2. It says I could run a program off of CommandPromt if I put the filepath and then end it with "\bin" then once it loads all i have to do is type in the program with ".exe" at the end...my problem is doing the file path. When I open Command Promt it already has my "C:\Users\MyName>". I don't think its a problem but the book acts like the command prompt should start blank and ready to add a filepath from scratch. Another thing is Im not too sure why projects save so many files. With vb6 it saved the form and the module and with visual studios it saves a lot more...i think i saw "directory" in there. Again i think the book is using an older version because the start screen is different.

    3. A more simple question is that my book has grids on its forms.

    4. It says i can go to the help menu and look for "show start page" or something like that to customize my version how I want. It then shows when you click it you have a drop down menu and can click VB6 to make my envoirnment to look like vb6. I don't have that option in my help menu maybe someone can tell me where I can do this or give me helpful tips on things I can customize to see how i would like it.

    5. Another simple question is the book had an example of centering a label by clicking on a label put on the form and then changing its alignment property to "top center". I did the following and nothing happened in design view OR in runtime. Looking at the book it seemed to center after changing the alignment right in the design view.



    I really am convinced I just have a newer version of visual studios than the book. Again I am using Visual Studios.NET 8 Standard Edition. Anyway hopefully someone can help me out on some of my questions. The help is greatly appreciated and I thank anyone who helps me in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Lightbulb Re: Visual Studios.Net Program Question

    1.If this is true where would i declare a variable with a wide scope or a "global variable"?

    Create a module, and add Public Variables there, and they will be GLOBAL to your project.

    2. It says I could run a program off of CommandPromt if I put the filepath and then end it with "\bin" then once it loads all i have to do is type in the program with ".exe" at the end...my problem is doing the file path.

    To get to the root folder, type CD \ and press ENTER, but you can also go to the TOOLS menu of Program Files, there is a VS Command Prompt icon.
    The BIN files get created in either the DEBUG or RELEASE folder of a project, depending on the compilation options.
    The 'application' file is created in \BIN when it compiles successfully.

    Your other questions can be answered, but you should just look them up. Have you tried msdn?

    http://msdn.microsoft.com/en-us/vbasic/default.aspx
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Nov 2008
    Posts
    16

    Re: Visual Studios.Net Program Question

    No i haven't thank you for your help and link

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Visual Studios.Net Program Question

    Windows Form Designer generated code is seen in VB.NET 2002 & 2003, from 2005 onwards, the desgn and code has been separated. With VB 2008 or 2005, you will see that you have 2 files for each form - 1 for design, and 1 for the coding. If you were to click the show all utton in Solution Explorer, you'll see the "hidden" design file.

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

Featured