how do you Dim a non valid identifier

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • negus
    New Member
    • Jan 2010
    • 18

    how do you Dim a non valid identifier

    scenario:
    im working on a periodic table of elements with buttons for each element-done
    next step. textbox + chemistry formulas = grams to mole conversions/ moles to L/ moles to molecules.

    the problem I'm having is dimming the chemicals Arsenic(As) and Indium(In) i need to dim these as integers = to their atomic mass G/Moles. but i am not able to Dim them because they are highlighted in blue and the help tip comes up as "keyword is not a valid identifier" is there anyway i can tell VB to not use "In" and "As" how it normally does and use it for integer values?

    please get back at me with any related help. thanks!

    -negus
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Please provide the code that is producing the error

    How I would do it:
    Make a class such as 'Element' which has all the various properties, then make a list of them.

    C# code... sorry... but you get the concept and should be able to do in VB
    Code:
    List<Element> TableOfElements = new List<Element>();
    public class  Element
    {
        public string Name { get; set; }
        public float Mass { get; set; }
        public string Abbreviation { get; set; }
        public int Number { get; set; }
    }
    
    public void MakeElement(string NewName, float NewMass, string NewAbbreviation)
    {
        Element NewElement = new Element();
        NewElement.Name = "Oxygen";
        NewElement.Mass = 15.9994f;
        NewElement.Abbreviation = "O";
        NewElement.Number = 8;
        TableOfElements.Add(NewElement);
    }

    Comment

    Working...