Correctly Naming Variables/controls?

Sep 1, 2010

Can some one please be kind enough to link me m$ naming guide lines.

View 2 Replies


ADVERTISEMENT

Naming Conventions - Name Member Variables In .NET?

Jun 9, 2010

I am generally not one to engage in subjective arguments over matters like variable naming, code formatting, etc. So I have no intention of starting an argument here.I just came across this (old) blog post which recommends not prefixing member variable names:

[Code]...

I get it: member variables can be lower camelCase, and public properties/methods can be PascalCase. But VB.NET is case-insensitive, so you can't really give a private member the same name as a public property except with a lower case first letter.I've generally prefixed member variables with an underscore, but I've been told that's not idiomatic.

So really I'm just curious: how do you name your member variables in VB.NET? And is there a "standard" way?

I'm not asking because I believe there's a "right" way or because I particularly want to change my style, and certainly not because I have any desire to tell others they're "wrong." Like I said, I'm just curious.

View 7 Replies

Naming For Namespace / Class And Variables

Jul 7, 2009

In the code below, the namespace is called "Navigation" which I think is correct. Then I have a class called "Heading", which by definition is the direction a person/vehicle is truly pointing towards. I think that is also named correctly. In the code below, I have four things I have named:
_WhatToName1, WhatToName2, WhatToName3, and WhatToName4.
The value that gets passed in and stored is a double between 0 and 360 -- essentially the degree value from a circle. For WhatToName3 and WhatToName4, I have seen a lot of places that just use "value" as the name. Is that standard?

Namespace Navigation
Public Class Heading
Private _WhatToName1 As Double
Public Sub New(ByVal WhatToName3 As Double)
Me.WhatToName2 = WhatToName3
[Code] .....

View 18 Replies

Naming Convention For Variables In Class Constructor

Nov 26, 2010

In the past when I have written classes and constructors, I named the variables in the constructor parameter something different than what would have been stored in the actual class itself.What I do now is name them the same, and reference the internal variables with Me.varname.Here is a class I just started building.Is my naming convention incorrect? [code]

View 1 Replies

Slow IDE - Faster Way Of Naming Controls?

Sep 21, 2010

I have experienced this in both VB 2005 and 2008. First, design a form by placing your UI elements where you want them. Then, go back and start naming your controls the way you want them (i.e. "txtWhatever" instead of the default "TextBox1", etc.).I find that after you change the name of a control, there is a slight but annoying delay as VS IDE digests the fact that you changed the name, thus slowing down my workflow. I recall that this process was much more rapid-fire in the VB6 days - i.e. name one control, click the next one and start typing, boom-boom-boom.

Has this annoyed anyone else, and if so, have you found any kind of remedy to speed things up in this regard?

View 8 Replies

VS 2008 Change Default Naming Of New Controls

Nov 24, 2011

I was just wondering is there a way to change the default name when you add a new control? I like to name my controls btnSomething etc... and if i could change the default names of added buttons from Button1, Button2 etc to btn1, btn2 etc.It will save me time when renaming.(Same applies for toolstripmenuitem buttons)Actually what would be ideal is if when i add a button, i directly go to the input for Text, and when i change that for the first time (like with toolstripmenuitems) the name changes according to the text (e.g. when you add a toolstripmenuitem in a context menu strip, if you set the text to "Reset" the name becomes ResetToolStripMenuItem. It would be awesome if i could make it automatically name to btnReset for buttons and tsmReset for toolstripmenuitems.)If there is a way to do this, even a difficult and not exactly pretty one involving macros and an input box, i would like to know

View 4 Replies

Paypal Variables Not Posting Correctly?

Mar 23, 2011

I am building a completely custom shopping cart for a client, and thesession("Payment_Amount") nor anything is posting to paypal.

Protected Sub OrderBtn_Click(sender As Object, e As System.EventArgs) Handles OrderBtn.Click
If OrderSummaryLit.Text = "" Then

[code].....

View 1 Replies

Variable Naming Conventions To Illustrate Variable Type And Where Variables Are Declared

Aug 24, 2009

I am looking for a good resource on variable naming conventions to illustrate variable type and where variables are declared. So I will have public variables, Private variables, private or local variables. I also may want to declare variables with the same name in different class code (i.e. in the code behind different forms). I am assuming good coding would dicatate a prefix for declaration location.

View 4 Replies

NumericUpDown Controls - Update Some Variables Each Time One Of These NumUD Controls Changes Value

Nov 20, 2011

I've got a couple of these NumericUpDown controls I put on a form. Without describing too much about the form I basically want to update some variables each time one of these NumUD controls changes value. So for each NumUD I have a call to a Recalculate subroutine within their "changedValue" event.

There are actually two problems. First, if I initialize the "Value" property to something other than zero in VB2010 at DESIGN TIME it won't even open the form when I hit RUN. It gives me a "No Source Available. No symbols loaded for any call stack frame" error. The error box says "InvalidOperationException" was not handled. So if I try to set the initial value of the Value property to anything but zero of either I get this error.

[Code]...

View 7 Replies

.net - Correctly Assign Data To Controls, SQL Server, VS2008

Jan 1, 2012

How may I correctly assign textboxes, dropdownlists & labels to appropriate fields, on successful retrieval of records via a SQL statement? I have 4 tables & therefore, the assigned data don't match the controls. (VS2008)

I have the following:

[Code]....

View 1 Replies

VS 2008 Recursive Check For Empty Controls Not Working Correctly?

Mar 24, 2011

I have made a form that consists of textboxes nested in groupboxes nested in tabpages. I want to check if all textboxes are empty in every groupbox and even if the controls from a groupbox in a groupbox are empty.When they are empty i should not create an element string for my .xml document.Below is the code that I have at the moment. I call it with the form as the parameter.

Public Sub recurringControls(ByRef ctl As Control)
For Each c As Control In ctl.Controls
If c.Controls.Count > 0 Then
If c.Tag IsNot Nothing Then

[Code]...

View 1 Replies

Inherit Form - Events From AaMyForm Execute Correctly But Controls Added To It Are Not Shown On XForm

Oct 31, 2011

Public Class aaMyForm
Inherits Windows.Forms.Form

Added some controls. Build it, add the .DLL as reference to my other project.

In my other project:

Imports MyLib
Public Class XForm
Inherits aaMyForm

The events from aaMyForm execute correctly but the controls added to it are not shown on XForm. I have found some info about set Modifiers Protected in order to be able to change the functionality of the controls but havent found anything about why the controls aren display on the XForm.

View 5 Replies

Using Variables In Controls?

Aug 31, 2009

I am trying to program a Yahtzee game. I would like to use a random number (out of a six sided die) and show the appropriate dice image based on the number generated. I have six predefined pictureboxes that each have a side of the dice image. I want to mimic the picturebox based on the number received.

For example:

x = Int(1+Rnd()*6)
die1.Image = diex.Image

Where x would be the random number and would pull from the appropriate picturebox.

View 2 Replies

Enumerating Controls With Variables?

Jun 22, 2010

If I had 5 text boxes on a form, TextBox1...TextBox5, is there a method to do something like this?

Dim strFld As String
For intFor = 1 to 5
strFld = "TextBox" & intFor
Me(strFld).Text = intFor
Next

It doesn't like the line of Me(strFld) but I figure there must be a way to reference a field via a variable instead of hardcoding the field name.

View 6 Replies

Maximum Number Of Controls And Variables?

Jan 13, 2009

how many variables and controls (i.e. text box, listview, buttons, etc) can a VB program has without slowing down its performance?

View 2 Replies

VS 2008 Reference Form Controls With Variables?

Nov 14, 2009

This code passes a button name ("Button2") and a value (4) to be displayed on it. Can the "UpdateButtonName" procedure be streamlined by replacing the "For Next" and "If Endif" code with something else since the button name is already known? It shouldn't have to check control on the form to see if it is the one I want.

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code].....

View 11 Replies

What To Use For Naming Conventions

Mar 25, 2011

What everyone uses for naming conventions?

View 3 Replies

Dynamic Naming Of Label

Feb 21, 2012

I'm a beginner in visual basic programming.I want to make login form in vb and i want that after signing in,another form opens with message "Welcome (User name)".This user name will be given at run time. So i just want a guidance in how to implement this thing in vb.

View 1 Replies

IDE :: Re-naming/re-using A Windows Service?

Oct 18, 2011

I've created a VB.NET2010 stub service application with a bunch of common features that I'd like to be able to use repeatedly as the starting point for various more specialized projects.

For each spin-off project I want to be able to start with the stub and then rename the service "completely", so that each instance behaves as if it was created from scratch with its own unique name.

I've tried the steps below with limited success; the re-named service builds as wanted/needed, BUT it won't run because I can't add the new service name to the StartupObject pulldown list.

Change ServiceInstaller.ServiceName from stubName to newSvceName.

View 2 Replies

Naming The Text Editor?

Mar 5, 2009

how when i open my text editor that in the blue area at the top it displays "untitled" but when a file is saved it shows in blue the new title name.im using vb2008?

View 7 Replies

Object Naming Through Code

Jul 27, 2011

I am creating the pictureboxes through code in VB, and I am trying to give them instance names through code, since they do not exist in the forms physically (I cannot manually name each one), only when I run my application (using VB 2008 express). The pictures work, they are displayed when I run the application but I need to find a way to be able to call each one because I need to create motion animation for every separate picture object.

[Code]...

View 2 Replies

Object Naming Without Hungarian?

Apr 5, 2010

Mostly because of reading this site, I'm trying to move away from Hungarian Notation. Or I guess the improper (system) Hungarian.

I can figure out a better way to name most data types, but I don't know what to do with objects. What would be a good naming convention for objects? I use objRS for recordsets now.

View 3 Replies

.net - Naming Standard For Generics - Of T Or Of TEntity?

Mar 16, 2011

I know this is a stupid question maybe, but what is the naming standard for generics?Of t or Of TEntity or Of..it doesn't really matter?I see IQueryable(Of T) but then DBSet(Of TEntity).

View 3 Replies

C# - Implement Column Self-naming From Its Index?

Mar 1, 2011

I wish to be able to instantiate my Cell class while naming the cell instance with such name as "A", "B", "C", etc. just like in an Excel spreadsheet.

I have my Cell class like so:

public class Cell {
public Cell(Range nativeCell) {
NativeCell = nativeCell;

[Code].....

I would need to generate a name based on the alphabetic letters and double and triple them once I encounter the last alphabet letter 'Z'. The algorithm would have to generate the letters that I would concatenate with the rowIndex value that would result to this naming strategy such as Excel.

The letters would be:

A, B, C, D...Z, AA, AB, AC...AZ, BA, BB, BC...BZ, CA...XAA, XAB, XAC...

While we clearly know that colIndex value 1 will definitely designate column "A", value 2 = "B", value 3 = "C", etc.

My problem is particularly when we double the letters.

how I could achieve this in the simplest possible form?

View 2 Replies

Constructor Variable Naming Convention?

Jan 25, 2012

I have a class (let's call it foo) that has several public properties.

private _fee as object
private _fie as object
private _fo as object

[Code]....

So far this seems to work... I'm just worried that something might get screwed up scope wise.

What is the normal way someone would name the constructor variables in a class like this?

View 9 Replies

Dynamic Variable Naming At Runtime?

Oct 30, 2009

I am trying to create a number of objects depending on the width of a row of an array, is there a way I can change the name of the variable being Dim 'd as I don't know how wide the array will be.

I have been trying something along the lines of:

pseudocode
For x as integer = 0 to UBound(MyArray,2)
Dim Object & CStr(x) As Object Type
Next

View 3 Replies

VS 2008 Naming Standards For Constants?

Feb 24, 2010

Are there any naming standards for constants that are different than variables? ex: Const for the prefix of the name.

View 3 Replies

VS 2010 DataGridView Naming In Runtime?

Jan 7, 2011

I'm creating an application that allows the user to create their own queries based on criteria in various list boxes and my idea was to produce the results of the SQL in a "new" DGV, which in turn will be created in a "new" TabPage in a separate form . Each time the user runs a query a new DGV and TabPage is created. I've named each "new" DGV based on a user textbox so each "new" DGV will be named differently. The problem is how do I reference each new DGV? At the moment I get-"the value of type 'Syst.cannot be converted to string"It allows me to name the DGV with a string, but not reference it!

Any ideas how I reference a DGV when its created in runtime.

[Code]...

View 2 Replies

VS 2010 Form Naming Standards?

Jun 6, 2011

have a form that is used to enter employee information and I also have a class object that I use to validate data and pass employee information around. What are the proper names for the form and the class?

View 9 Replies

C# - Naming Convention For Interface Implementator's Object?

Sep 16, 2010

What is the most commonly used convention (in C# and VB) to name object, when I want to emphesize that it is an instance of class that implements some interface. Like here:

//is iDisp correct name?
protected void Dispose(IDisposable iDisp)
{
iDisp.Dispose();
Console.WriteLine("Disposed");
}

View 4 Replies







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