Visual Basic Created 15 years ago2008-10-13 04:09:19 UTC by Spike Spike

Created 15 years ago2008-10-13 04:09:19 UTC by Spike Spike

Posted 15 years ago2008-10-13 04:09:19 UTC Post #256993
Interested in learning Visual Basic.

Any help, advice? Where/How to start?
Posted 15 years ago2008-10-13 04:48:15 UTC Post #256995
Look around the MSDN learning center, all the info your going to need:

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

Good luck!
Posted 15 years ago2008-10-14 05:10:35 UTC Post #257031
Why Visual Basic? Learn a real programming language. If you really want to, there's a Wikibook for it.
Posted 15 years ago2008-10-14 05:18:54 UTC Post #257032
Visual Basic is a good language for beginners IMO. I mean, it's pretty useless IRL, but it's good to get people in the right state of mind before attempting harder languages.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-14 06:48:18 UTC Post #257040
I already know C++. I want to learn Visual to make graphical interfaces, not just console programs
Posted 15 years ago2008-10-14 06:56:00 UTC Post #257041
In that case, you'd be better off using Visual C++, which does the same thing with C++ that Visual Basic does with the forms designer.

Just create a new
C++ > CLR > Windows Forms Application
and go from there.

Or you could use C#.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-14 07:41:48 UTC Post #257047
I'd say that Python (or Perl, or Ruby) is a far more useful language - it's easy to learn and quite productive to use.

As for GUI programs, Penguinboy already said what I wanted to say. If you don't mind the .NET dependency, C# really is the way to go.
Posted 15 years ago2008-10-14 07:44:07 UTC Post #257048
What's wrong with .NET dependency, doesn't it come with all windows? (I don't use Linux and I'll never use it)
Posted 15 years ago2008-10-14 09:17:30 UTC Post #257049
If you're just making applications for your own use, then don't worry. But if you're planning to distribute them to others, you'll have to take such things into account: not everyone has the .NET framework, not everyone has the same version, etc. I'm no expert on how widely .NET versions are available but these are things to keep in mind.
Posted 15 years ago2008-10-14 09:35:38 UTC Post #257050
You also got a few extensions for python that allow you to make a interface the same way the visual studio series does. although it can be quite tedious finding the right modules to work the the programs.

I think the 2.0 net version is most widely distributed. Although 3.5 is the most recent if my memory serves me right.
Posted 15 years ago2008-10-14 11:24:43 UTC Post #257052
I'd say go for Visual Basic .NET.

The software you need to program VB.NET Windows Application is here.

I used the same language and software to develop my Compilator and the Half-Life Launch Pad utilities.

I can get you started.
The Mad Carrot The Mad CarrotMad Carrot
Posted 15 years ago2008-10-14 15:23:22 UTC Post #257060
If you're going to work on Visual Basic or C#, use SharpDevelop instead. It has a function that automatically converts VB to C#, Muzz, you should JOIN THE C# REVOLUTION! Admit your VB wrongdoings!

No but seriously, C# is so many times better than VB (which is amazing because they're both wrappers of the exact same framework)
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-14 16:09:49 UTC Post #257071
What makes them different? Libraries?
Posted 15 years ago2008-10-14 16:18:03 UTC Post #257072
It has a function that automatically converts VB to C#, Muzz,
Wtf!

I was thinking about this the other day; why not convert my Compilator and my Half-Life Launch Pad to C# code instead, because i've heard its faster.

The problem is, i don't know jack shit about C#, even though VB.NET and C# code blocks may look almost identical.

But, if SharpDevelop can convert my apps to C# code, then awesome! :D I can then learn more about C# by looking at the converted code.

So... should i?
The Mad Carrot The Mad CarrotMad Carrot
Posted 15 years ago2008-10-14 16:24:09 UTC Post #257073
Of course it't not a perfect converter (I doubt it would compile once you initially convert it), but I highly recommend converting it. C# is much more flexible.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-14 16:24:31 UTC Post #257074
So... should i?
Well, I dont see a reason not to. Even if you dont release it to us, it's a C# study for you ;o
TheGrimReafer TheGrimReaferADMININATOR
Posted 15 years ago2008-10-14 17:01:41 UTC Post #257079
I was thinking about this the other day; why not convert my Compilator and my Half-Life Launch Pad to C# code instead, because i've heard its faster.
Not really, no. C# and VB.NET offer pretty much identical performance since they're both compiled down to the same CIL code. The real choice you're making is to use the .NET framework; choosing between C# and VB.NET is really a matter of personal taste. To be honest Muzz, I don't see the point in converting your app to a language you're not comfortable with and possibly introducing new bugs in the process just to appease the C# evangelists ( :P ). You won't make it run any faster, the code will be harder to maintain, and the end-user won't even know the difference.

And why use SharpDevelop just for the code conversion feature when there are plenty of other sites that do just that?
Posted 15 years ago2008-10-14 17:19:19 UTC Post #257081
I don't use SharpDevelop just for the conversion - in fact I've never used the feature myself. SD is quite a bit better than Visual Studio when it comes to features, size, etc. Its autocomplete is leagues better than VS, it's cleaner, faster, takes less time to start up, and it's open source, therefore free, no need for annoying "express" this and "professional" that.

While I've already mentioned that VB and C# use the exact same framework, C# is more flexible in terms of structure and code layout. (in my opinion)
Nowhere did I say it was faster than VB, that was just Muzz :P
I suppose I just like the C++-like syntax better than VB's wtf-like syntax.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-14 17:46:00 UTC Post #257082
Ok, im not doing it. :)
The Mad Carrot The Mad CarrotMad Carrot
Posted 15 years ago2008-10-14 18:01:53 UTC Post #257083
I'm going to learn C# because I already know C++ and syntax is similar.

Some site where I can see what libraries does? Like a TWHL entity list but libraries?
Posted 15 years ago2008-10-14 18:05:11 UTC Post #257084
Posted 15 years ago2008-10-14 18:28:59 UTC Post #257085
C# syntax is not very similar to C++ at all. Its closer to Java than anything.
Posted 15 years ago2008-10-14 18:30:42 UTC Post #257086
And Java syntax is very similar to C++. What's your point?
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-14 18:36:11 UTC Post #257087
Not from my experience :|
Posted 15 years ago2008-10-14 18:38:38 UTC Post #257088
I think you're confusing syntax with functionality.
Fact is, there are tons of languages that borrow from C-style syntax, and C++, Java, and C# are 3 examples.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-14 18:56:11 UTC Post #257089
You killed my edit. I'm still talking about the written syntax here.
I spent all of last summer doing IT work for a power company where my one and only task was to port a single program from C++ to C#, and had to learn C# as I went along. It was very, very, very different from C++. The basic layout of variable inside method inside class isn't nearly enough to say the two are similar.
If you're basing your position on what you've seen in Valve's SDK-- they use simplified syntax that pretty much any entry-level university student could read.

I don't know how much of either language you've worked with outside of school, but I can assure you that what they teach in a university is extremely elementary in comparison to the kind of programs large corporations use. If you haven't been through an IT internship yet, you're in for a big surprise.
Now, if you have been doing some "real world" work, and I mean on the corporate level [not TWHL or small-time game re-coding], then feel free to tell me I'm a dumbass. But again, from my experience, the syntax is very different.
Posted 15 years ago2008-10-14 19:02:10 UTC Post #257090
I don't know what you're getting at by syntax but I'm talking about curly brackets and the like. Visual Basic doesn't use brackets:

C#/C++/Java:
if (true)
{
//do something
}
else if (false)
{
//do something else
}

Visual Basic (or close enough):
If true Then
'do something
ElseIf false Then
'do something else
EndIf

See how the C++ syntax just flows better? That's what I mean.

EDIT: I have never opened the Half-Life SDK code.

EDIT2: I realise that there's a lot of fucked up C++ code out there, but have you ever thought that some people (like Valve, if what you say is true) might want their code easy to read, to endorse maintainable code? It's good programming practice to let a "entry-level university student", as you say, be able to understand your code. It's not that "large corporations use code that nobody can understand", it's that "poorly designed code is hard to understand". This applies to ANYONE, no matter their level of experience.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-14 19:03:51 UTC Post #257091
Why Visual Basic? Learn a real programming language.
How the hell is Visual Basic not a real programming language? Because it's BASIC?
Posted 15 years ago2008-10-14 19:29:04 UTC Post #257092
That's exactly what I'm talking about, and what I'm telling you is that things as elementary as brackets and if statement structures do not mean two languages' syntax is similar. Syntax encompasses everything of how the language is written-- how you carry out your orders to the machine. And they are written radically differently for each.
Computer languages work a lot like human languages, they really do. A lot of languages are based on Latin, but use different grammar structures, and a lot of words that exist in some languages don't exist in others. Some things can translate over fairly simply, but if you try to speak one language as you would another, it wouldn't make sense. if you try to write C# the same way you write C++, it wouldn't work. Again, this goes beyond the basic 30-something keywords and the variable->method->class structure.

Then you have stuff like VB that use a completely different base all together: IE Latin and Arabic.

Don't be an ass and say everything is derived from binary. I'm on to you :cyclops:

Edit: Just read your second edit. Maybe its just that with C++, its so easy to have a messy wall of code, while its easier to read Java or C#. But that's the point I'm trying to make. If they were similar enough to say "if you know C++, you basically know C#", then it would be just as easy to make a messy wall of code in C#. Its not, though. You almost have to try to make C# look nasty because of how clean the syntax is :P
Posted 15 years ago2008-10-14 19:35:05 UTC Post #257093
Yeah, you're talking about functionality. Pointers may have their own syntax, for example (incidentally, you can use pointers with the exact same syntax in C# using unsafe code), but that's really beside the point.

Differences in functionality really have no impact on how the code is laid out. For example, the following code will compile in C#, C++, and Java. It has a lot of the basic syntax of the language(s).
public int doSomething() {
    int x = 4;
    x++;
    for (int i = 0; i <= 78; i++) {
        x *= i/i--;
    }
    return x;
}
Any languages that are this similar can be considered to have similar syntax. Notice that I never said that the syntaxes (syntii?) were exactly the same, but the general layout of a block of code in the languages are similar. Without seeing obvious language-specific identifiers, it's hard to tell the difference, if you're just looking at a block of code.
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-14 20:09:35 UTC Post #257094
I'd say that C++ and C# syntax is rather similar (although I'd argue that C++' syntax is more complicated). But that's probably the biggest similarity between those languages.

Take a look at Python if you want to see a different syntax. Or, even better, Lisp. Once you've seen some of those languages, C++, C# and Java really do look similar.
Posted 15 years ago2008-10-14 22:01:33 UTC Post #257095
I'm going to learn C# because I already know C++ and syntax is similar.

Some site where I can see what libraries does? Like a TWHL entity list but libraries?
Then you are going to need a good text book on the subject. Now, I myself just recently purchased a copy of Apress's "Beginning C# 2008: From Novice to Professional". This is a $40.00 hard cover book, but I also got with it an "ebook" version of it (the whole book as a pdf file).

Since you seem interested in C#, I will do you a favor and let you and anybody else for that matter download the ebook right from this link: http://66.7.210.142/~virtualh/Apress.Beginning.C.Sharp.2008.From.Novice.to.Professional.Nov.2007.zip
User posted image
This version here is the first edition, I'm told a second edition has been already released. For more info on this book or any of the many programing books from Apress, go here: http://www.apress.com
Posted 15 years ago2008-10-14 22:47:36 UTC Post #257096
Nods at Captain P's post and winks slyly at World Crafter

I've done Scheme so I know what different syntax looks like ;D
Penguinboy PenguinboyHaha, I died again!
Posted 15 years ago2008-10-17 06:01:16 UTC Post #257102
thank u dudes

EDIT: wtf guys, I installed all the stuff, I even made the Hello World program which is working fine. Now I'm trying to compile a calculator with a source code I found on the internet and I get errors like:

namespace 'Windows' doesn't exists on namespace 'System'
namespace 'Drawing' doesn't exists on namespace 'System'
Can't find namespace 'Form'
Can't find namespace 'Button'
Can't find namespace 'Panel'

etc etc

The source code is:

[quote]using System;
using System.Windows.Forms;
using System.Drawing;

public class win:Form {
Button[] b = new Button[10];
Button bDot,bPlus,bSub,bMul,bDiv,bEqu,bClr;
Panel panCalc;
TextBox txtCalc;

Double dblAcc;
Double dblSec;
bool blnClear,blnFrstOpen;
String strOper;

public win() {
   try {
	this.Text="Calculator";
	panCalc=new Panel();
	txtCalc = new TextBox();
	txtCalc.Location = new Point(10,10);
	txtCalc.Size=new Size(150,10);
	txtCalc.ReadOnly=true;
	txtCalc.RightToLeft=RightToLeft.Yes;
	panCalc.Size=new Size(200,200);
	panCalc.BackColor=Color.Aqua;
	panCalc.Controls.Add(txtCalc);
	addButtons(panCalc);
	this.Size=new Size(200,225);
	this.Controls.Add(panCalc);

	dblAcc=0;
	dblSec=0;
	blnFrstOpen=true;
	blnClear=false;
	strOper=new String('=',1);
    }
    catch (Exception e) {
	Console.WriteLine("error ......  " + e.StackTrace);
    }
}

private void addButtons(Panel p) {
	for (int i=0;i<=9;i++) {
		b[i]=new Button();
		b[i].Text=Convert.ToString(i);
		b[i].Size=new Size(25,25);
		b[i].BackColor=Color.White;
		b[i].Click+=new EventHandler(btn_clk);
		p.Controls.Add(b[i]);
	}
	b[0].Location=new Point(10,160);
	b[1].Location=new Point(10,120);
	b[4].Location=new Point(10,80);
	b[7].Location=new Point(10,40);

	b[2].Location=new Point(50,120);
	b[5].Location=new Point(50,80);
	b[8].Location=new Point(50,40);

	b[3].Location=new Point(90,120);
	b[6].Location=new Point(90,80);
	b[9].Location=new Point(90,40);

	bDot=new Button();
	bDot.Size=new Size(25,25);
	bDot.Location=new Point(50,160);
	bDot.BackColor=Color.White;
	bDot.Text=".";
	bDot.Click+=new EventHandler(btn_clk);

	bPlus=new Button();
	bPlus.Size=new Size(25,25);
	bPlus.Location=new Point(130,160);
	bPlus.BackColor=Color.White;
	bPlus.Text="+";
	bPlus.Click+=new EventHandler(btn_Oper);

	bSub=new Button();
	bSub.Size=new Size(25,25);
	bSub.Location=new Point(130,120);
	bSub.BackColor=Color.White;
	bSub.Text="-";
	bSub.Click+=new EventHandler(btn_Oper);

	bMul=new Button();
	bMul.Size=new Size(25,25);
	bMul.Location=new Point(130,80);
	bMul.BackColor=Color.White;
	bMul.Text="*";
	bMul.Click+=new EventHandler(btn_Oper);

	bDiv=new Button();
	bDiv.Size=new Size(25,25);
	bDiv.Location=new Point(130,40);
	bDiv.BackColor=Color.White;
	bDiv.Text="/";
	bDiv.Click+=new EventHandler(btn_Oper);

	bEqu=new Button();
	bEqu.Size=new Size(25,25);
	bEqu.Location=new Point(90,160);
	bEqu.BackColor=Color.White;
	bEqu.Text="=";
	bEqu.Click+=new EventHandler(btn_equ);

	bClr=new Button();
	bClr.Size=new Size(20,45);
	bClr.Location=new Point(170,40);
	bClr.BackColor=Color.Orange;
	bClr.Text="AC";
	bClr.Click+=new EventHandler(btn_clr);
	p.Controls.Add(bDot);
	p.Controls.Add(bPlus);
	p.Controls.Add(bSub);
	p.Controls.Add(bMul);
	p.Controls.Add(bDiv);
	p.Controls.Add(bEqu);
	p.Controls.Add(bClr);
}

private void btn_clk(object obj,EventArgs ea) {
	if(blnClear)
		txtCalc.Text="";

	Button b3=(Button)obj;

	txtCalc.Text+=b3.Text;

	if (txtCalc.Text==".")
		txtCalc.Text="0.";
	dblSec=Convert.ToDouble(txtCalc.Text);

	blnClear=false;
}

private static void Main() {
	Application.Run(new win());
}

private void btn_Oper(object obj,EventArgs ea) {
	Button tmp=(Button)obj;
	strOper=tmp.Text;
	if (blnFrstOpen)
		dblAcc=dblSec;
	else
		calc();
	blnFrstOpen=false;
	blnClear=true;
}
private void btn_clr(object obj,EventArgs ea) {
	clear();
}
private void btn_equ(object obj,EventArgs ea) {
	calc();

}

private void calc() {
	switch(strOper) {

		case "+":
			dblAcc+=dblSec;
			break;
		case "-":
			dblAcc-=dblSec;
			break;
		case "*":
			dblAcc*=dblSec;
			break;
		case "/":
			dblAcc/=dblSec;
			break;
	}

	strOper="=";
	blnFrstOpen=true;
	txtCalc.Text=Convert.ToString(dblAcc);
	dblSec=dblAcc;
}

private void clear() {
	dblAcc=0;
	dblSec=0;
	blnFrstOpen=true;
	txtCalc.Text="";
	txtCalc.Focus();
}
}[/quote]
Posted 15 years ago2008-10-17 06:32:48 UTC Post #257239
If that's how's c++ look ( shit code) I'm out
Striker StrikerI forgot to check the oil pressure
Posted 15 years ago2008-10-17 06:37:30 UTC Post #257240
c++ pwns, go learn Fortran LOL
Posted 15 years ago2008-10-17 07:12:53 UTC Post #257241
It looks pretty normal to me, i find it rather nice to work with C++. Mostly because the syntax in AS3 looks very similar.
Posted 15 years ago2008-10-17 07:35:50 UTC Post #257242
Looks more like C#, not C++.

What tutorial did you look at, Spike, and what IDE are you using (and for that matter, what language did you finally decide to go with)?
Posted 15 years ago2008-10-17 07:43:02 UTC Post #257244
lol it's C# and I compiled it on Sharpdevelop editor
Posted 15 years ago2008-10-17 08:31:11 UTC Post #257249
Seriously, this thread is full of nerds. :P:D

Carry on. :)

C++ looks like a cluttered mess of random characters with some normal looking sentences/lines here and there.
The Mad Carrot The Mad CarrotMad Carrot
You must be logged in to post a response.