Ways To Declare/define Variables?

Feb 12, 2010

This is a VB.Net newbie question. I'm confused at the different ways to declare and define variables.Here's an example:

Dim URL As String = http://www.c-sharpcorner.com/default.asp
Dim request As HttpWebRequest = WebRequest.Create(URL)
Dim response As HttpWebResponse = request.GetResponse()

[code]......

View 1 Replies


ADVERTISEMENT

Different Ways To Declare Variables?

Aug 20, 2009

I'm new to VB.NET programming.What I'm confused about is the different ways one can declare a variable.Would someone please explain the difference between the two declarations below? [code]

View 2 Replies

Define Some Global Variables Of A Class - Variables Occupy Memory?

Mar 23, 2012

I define some global variables of a class as follows:

Private Class MyClass
Private var1 as Decimal
Private list1 as List(Of string)[code].....

But I found that after this form is closed, all above variables, var1, list1, list2 still exist in memory. I thought they should be collected by gc since the form is already disposed as I confirmed.

Add: I have monitored half an hour after the form is closed. But these variables are not collected by gc. I have an automatic update procedure on the form which uses above variables.Since the above variables still hold values, the automatic update procedure is always called which causes exception. (One quick fix is to check if form.isDisposed in update procedure. But I do not think this is elegeant. Besides, these variables occupy memory.)

View 2 Replies

Declare And Define An Object Dynamically?

Apr 19, 2009

I have the following situation, can anybody help me in that?Following is a "pseudo" code of what I want to do in VB using VB.NET 2005:

[Code]...

View 2 Replies

Define And Declare In Class Module?

May 25, 2011

below is my code to use binarywriter it work fine on class form1 level

[code]...

View 2 Replies

Programmatically Create And Define Variables?

Dec 28, 2011

I'm looking to define string variables from an array of strings.

x(2) = {"bar","foo"}

How do I create variables out of bar and foo? And then how do I assign them a value?

View 3 Replies

Variables To Define Which Object To Update?

Jun 12, 2011

I am trying to figure out how to use variables to define which object to update. I could of course use a case statement to pick the object based on a variable, but it seems to me like there should be a more direct way. Here is a smaller example of what I would like to do.In my form I have 4 picture boxes (pbox1, pbox2, pbox3, and pbox4). I then want to change the image in one of the boxes, but the box I want to change will be determined by a variable (say maybe a randomly generated number). Is there some way to dynamically concatenate the "pbox" with the number that VB would understand it and use it as an object?In this example I could easily build a case statement to handle the selection, but in my real program there will be many more than 4 options.

View 7 Replies

How To Declare Variables?

Feb 6, 2012

trying to figure out how to declare items here. here is the

[Code]...

View 2 Replies

Define Font In Printdocument After Declare "Imports Microsoft.Office.Interop.Excel"?

May 12, 2012

Imports Microsoft.Office.Interop.Excel

[Code]...

View 3 Replies

Declare Variables Dynamically?

Dec 10, 2009

Is it at all possible to declare variables dynamically? Something like Dim Answers & i As ArrayList. What I'm trying to achieve is putting one or more answers to a question into an array. Or should I really be looking at a mult-dimensional array to store the question number and answer? How would I add to and access a multi-dimentional array? Anyway, here's the section of code:[code].......

View 4 Replies

How To Declare Global Variables

Aug 16, 2010

How I can declare global variables in vb.net that I can access them in all windows of my application?

View 5 Replies

How To Declare Variables Properly

Jun 8, 2011

I am needing help in understanding how to declare variables properly. I am needing to write as program that calculates the commission for a sales person. I keep getting a error listed below. I thought I declared the salestextbox, costtextbox as integers correctly to use them in the calculation. I Copied my code below also. I have reread the chapter again and I am still lose.[code]

View 3 Replies

Declare Global Value Type Variables With New?

Dec 29, 2009

What happens if I do: Dim x As New Int32? Is a object of int placed on the heap? If it is, maybe your application would be able to access global variables faster if they were reference types.

A global variable as an value type should be somewhere at the bottom of the stack most of the time and it might take more time to get to this then to get a object from the heap. Unless it's the same story with the pointer of this object is also at the bottom of the stack of course.

View 9 Replies

How To Declare Variables To Make It Work

Feb 13, 2012

I am making a game that involves moving picture boxes automaticly i can get the boxes moving but I need them to be object orientated but when I try to make it a class i am not to sure how to declare the veriables to make it work. [code]

View 3 Replies

Create An Isolated Context Which Allows Declare Two Variables

Nov 29, 2011

I put "isolated context" in quotes because I don't know what else you would call it. Basically, in C#, you can do this:

{ int i = 0; }
{ int i = 1; }

The curly braces create an isolated context which allows you to declare two variables with the same name in the same method or property logic. Is this possible in VB.NET? Also, what do you call this aside from an isolated context?

View 1 Replies

Declare Some Global Variables For Use In Various Subs/functions?

Oct 21, 2011

At the head of a module, I wish to declare some global variables for use in various subs/functions.

What is the difference between.Dim x as string and Private x as string / Public x as string, and when would I use one over the other?

View 1 Replies

Declare Variables In Public Class Form1?

Apr 29, 2012

When and why do you declare variables in the Public Class Form1 section?

View 1 Replies

Declare Public Variables, Constants, Functions In A Proper Way?

Jan 13, 2011

I'd like to get a more refined programming style and I was wondering if any of you might give me a hand...(How to declare public variables, constants, functions...in a proper way),is there any useful link or pdf document I could have a look in order to improve my style?

View 5 Replies

Declare Variables For The Average Score And The Letter Grade?

Apr 18, 2011

I am taking an online class and I am having trouble getting my solution to work. My assignment is as follows: In the function, declare variables for the average score and the letter grade. Calculate the average, use If/ElseIf statements to determine the letter grade, and return the letter grade.

Create a subprocedure for the Click event for the btnDisplay button. It should call the CalculateGrade function with three arguments (the three test scores from the text boxes), and display the returned value in the lblGrade box.I have looked all over the internet and have had no luck finding an example to look at I am taking an online class and I am having trouble getting my solution to work. My assignment is as follows:

In the function, declare variables for the average score and the letter grade. Calculate the average, use If/ElseIf statements to determine the letter grade, and return the letter grade.

[Code]...

View 7 Replies

Declare Two Module Level String Variables Name StrCaptital And StrChoice

May 16, 2011

What I'm supposed to do is declare two module level String variables name strCaptital and strChoice and I did that. At least I think I put them in the right place, however what I'm not sure what to do is and I started is that I'm supposed to code each state radio button's click event procedures so that each assigns the appropriate capital to the strCapital variable and then each removes the contents of the lblMsg control.url...

View 3 Replies

VS 2008 Declare Variables Inside Each Event Handler / Program Runs

Mar 29, 2010

I am teaching myself VB, and when I try to run this program, I am getting "An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object." If I was to declare the variables inside each event handler, the program runs, but why won't it run when I make the scope public? Seems repititous having to declare the variables in every event handler. [code]

View 7 Replies

Declare Store And Access "global" Variables?

Jan 17, 2011

I have an application that I'm writing and I'm trying to declare two variables from my sql server, store the values and pass them to my forms.[code]...

View 5 Replies

.net - C#: Different Ways To Run Code Asynchronously?

Feb 14, 2011

I have this code List<string> myList = new List<string>();

myList.AddRange(new MyClass1().Load());
myList.AddRange(new MyClass2().Load());
myList.AddRange(new MyClass3().Load());
myList.DoSomethingWithValues();

What's the best way of running an arbitrary number of Load() methods asynchronously and then ensuring DoSomethingWithValues() runs when all asynchronous threads have completed (of course without incrementing a variable every time a callback happens and waiting for == 3)

View 4 Replies

Chat System With One Or Two Ways?

Jan 15, 2010

I'm trying con build a simple chat client/software (whole in on executable) wich start listen from the start on the port 5900 and when a client connect to that port the chat is established.

The problem is that only the client can chat to the server, the server cannot answer the client because the connection is working in one way.The i've tried to connect from "server" to the client when it establishes a connection but the system crash warning me that the port is already on use.

[Code]...

View 1 Replies

Delete A File In Many Different Ways?

Nov 14, 2011

What is the difference between these ways to delete a file.Is one of the methods better than the other?Are there other ways to delete a file (. Net 4)

System.IO.File.Delete(path
to file)

My.Computer.FileSystem.DeleteFile(path to file)

View 3 Replies

Different Ways For Playing Audio (MP3)?

Jan 28, 2009

I'm new to VB and have over the last week or two been looking at the different ways to play audio (mp3's). Windows Media Player, Microsoft Multimedia Control, Bass.dll, SndPlaySound, MCI SendString and DirectX (including audiovideoplayback, direct3d and directsound.) I originally decided to use windows mediaplayer, mainly because it seemed the logical choice but quickly found out I couldn't get it to work properly.

So I installed the Directx SDK but now I'm completely overwhelmed about what to use and why. I need to be able run the compiled code on a win 2k box, play an mp3 from start to finish then load and play another mp3 from start to finish and so on. Whats the difference between the varied choices and which would be the best for me to use?

View 5 Replies

Different Ways To Create Object

Jun 13, 2011

I want to know by how many different ways I can create an object. The most common usage I am aware about is:
Dim obj as ClassA = new ClassA().

View 1 Replies

Different Ways To Play Audio?

Dec 10, 2009

I'm new to VB and have over the last week or two been looking at the different ways to play audio (mp3's). Windows Media Player, Microsoft Multimedia Control, Bass.dll, SndPlaySound, MCI SendString and DirectX (including audiovideoplayback, direct3d and directsound.)I origninally decided to use windows mediaplayer, mainly because it seemed the logical choice but quickly found out i couldn't get it to work properly. So i installed the Directx SDK but now i'm completely overwhelmed about what to use and why.

View 3 Replies

Different Ways To Sending Emails Using .net?

Jul 14, 2009

What are the different ways to send the emails using vb.net?

View 4 Replies

Ways To Play Audio?

May 4, 2010

I'm looking at creating an mp3 player to keep myself busy. However I'm trying everything I can to avoid using the windows media player COM component. It makes it a little too easyWhile looking around I stumbled upon the DirectX.AudioVideoPlayback namespace and I was wondering if this would be sufficient. Would I be able to create an equalizer and other more advanced things for my application?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved