locked
How do I translate Eglish into VB? RRS feed

  • Question

  • Is there an English - Visual Basic dictionary that could help me translate my thoughts to code?  I am taking courses at the local community college and having difficulty with this "foreign" language.
    Wednesday, April 11, 2012 1:44 PM

Answers

  • VB is English, or very close to it.

    IF something happens THEN do a task.

    If your task is routine, you would put it into a Sub(routine).

    If you want to perform a mathematical Function then you'd have just that, returning the result AS a specific type.


    Stephen J Whiteley

    • Proposed as answer by Heslacher Wednesday, April 11, 2012 1:51 PM
    • Marked as answer by Youen ZenModerator Wednesday, April 18, 2012 8:08 AM
    Wednesday, April 11, 2012 1:50 PM
    Moderator

All replies

  • VB is English, or very close to it.

    IF something happens THEN do a task.

    If your task is routine, you would put it into a Sub(routine).

    If you want to perform a mathematical Function then you'd have just that, returning the result AS a specific type.


    Stephen J Whiteley

    • Proposed as answer by Heslacher Wednesday, April 11, 2012 1:51 PM
    • Marked as answer by Youen ZenModerator Wednesday, April 18, 2012 8:08 AM
    Wednesday, April 11, 2012 1:50 PM
    Moderator
  • Old English and Middle English are both English, but we would have trouble communicating with the residents of England in 800 - 1000 A.D.  I should have been more specific.  I was solving a problem where I wanted to create two columns on the display.  I knew that ControlChars.NewLine would be the code to start a new line; but I didn't know that ControlChars.Tab would move the cursor to the right and accomplish what I had envisioned.  This is what causes my biggest problems -- I am almost illiterate in VB.  How do I learn all of this?  Is it experimentation (trial and error)?
    Wednesday, April 11, 2012 1:59 PM
  • A programming language is not a human language. It's made for writing execution plans you write for "someone" (the CPU). Fortunatelly VB is pretty human oriented compared to cryptic languages like C and others. That's the main reason I use VB.

    What you describe is less a language problem. It describes the behavior of a control that interprets the tab character as a separator for columns. You can read this in the documentation of the control.

    If you start programming, you should do it step by step. If you already add content to a listbox, it implies knowledge about OOP (object oriented programming). This is a step too far if you don't have the previous knowledge about the language. OOP comes last.

    In any case you have to read, read, read....


    Armin


    Wednesday, April 11, 2012 2:33 PM
  • The way you have phrased your question, and the issue that prompted it, suggests that you haven't yet fallen into the mindset of what a programming language is.  Programming involves a way of thinking about what you are doing that is quite different than writing an English sentence, even though the end result looks quite similar.  Once you have started to adopt that mindset then everything suddenly becomes a lot more logical and you can see that the task is simply to become experienced in the technology.  Prior to that happening, it just all looks confusing.

    Your particular problem relates to the behaviour of strings, and particular control characters in strings, when they are displayed in a particular way.  It actually has very little to do with Basic, but a great deal to do with how you design a program to accomplish a task.

    In this case I would go back to thinking about your task and ask if there is a different way to do it.  You probably have experience putting text into a text box, and you indicate that you know how to format it into multiple lines.  What would be the result if you used two text boxes, placed inside a container such as panel which has a border, but with the textbox borders set to nothing, and positioned so they are immediately adjacent to each other?  Then, how would you arrange to put the text in the text boxes so you get your two columns?

    Once you understand how you want to build your program, the rest of the process - the code - does become a bit similar to translating from English to Basic. But you have to have a suitable design before you can start the translation, and that's the important part of programming.

    Thursday, April 12, 2012 7:45 AM