Ok, so I recently decided to give up VB.net and move onto a modern language, C#, I've found the transition pretty easy except for the fact that I cant seem to figure out how to do one thing in in particular that made my life alot easier while working in
VB.net which was calling subs that exist outside the current form.
Ex in VB:
Form 1
Public Sub Abc123()
'Do something
End Sub
Form 2
Public Sub SomethingElse()
'Do something else
Abc123()
'Do something else again
End Sub
Basicly how do I execute/call 'Abc123' that exists on Form 1 from inside of Form 2? I've already figured out that if Abc123 exists on Form 2 two already the syntax is the same as VB.net but I cant for the life of me figure out how to get it to work if it exists
on Form 1 and both Google and Windows Live Search arent of any help.
I hate asking the noob questions but I figured with all the professional programmers here on C9 someone would know the answer on how to get this to work in C#.
Thanks guys!
-
-
I'm not sure what you mean by C# being a modern language and VB.NET not being modern. They're the same thing overall, just different syntax for building IL.
The reason you can't do that in C# is because C# doesn't have support for default instances (this is arguable both ways on whether that's good or bad). To get around this your Form 2 will have to have a reference to the instance of Form1. You can do this a number of ways. You can pass it into the constructor of Form 2 or just make it a property on Form 2 that you set the instance of Form1 equal to.
Let me know if that doesn't make sense. -
It was just me trying to make a joke, heh, maybe I should have said 'the language I can eventually get a job working with' instead of saying it wasnt modern.
Thanks for the help, HumanCompiler, honestly I cant beleive the solution was so simple, I'm kicking myself as I type this because I didnt think to try that. -
No worries. Sometimes VB does so much for you that you forget what it's really doing to help you out.

-
Jason Cox wrote:It was just me trying to make a joke, heh, maybe I should have said 'the language I can eventually get a job working with' instead of saying it wasnt modern.
Thanks for the help, HumanCompiler, honestly I cant beleive the solution was so simple, I'm kicking myself as I type this because I didnt think to try that.
It's amazing that no matter how smart we get, and how versed in multiple languages we become, the simplest thing can make us look like the dumbest people alive
I experience this kind of crap all the time in my developments.
When I was starting HTML over a decade ago, I could never remember if the color was "gray" or "grey". I would typically do it the wrong way first, and then the correct way secondly. This crap stuck with me for alteast a year or so
And I used "gray" alot

-
jsampsonPC wrote:It's amazing that no matter how smart we get, and how versed in multiple languages we become, the simplest thing can make us look like the dumbest people alive

No doubt. Sometimes I space out and do or think stupid things and I ask myself if I even qualify as a human, let alone a human compiler.
-
HumanCompiler wrote:

jsampsonPC wrote: It's amazing that no matter how smart we get, and how versed in multiple languages we become, the simplest thing can make us look like the dumbest people alive 
No doubt. Sometimes I space out and do or think stupid things and I ask myself if I even qualify as a human, let alone a human compiler.
lol, maybe a little harsh on yourself at times no?
-
LaBomba wrote:

HumanCompiler wrote: 
jsampsonPC wrote: It's amazing that no matter how smart we get, and how versed in multiple languages we become, the simplest thing can make us look like the dumbest people alive 
No doubt. Sometimes I space out and do or think stupid things and I ask myself if I even qualify as a human, let alone a human compiler.
lol, maybe a little harsh on yourself at times no?
Not at all
When I was in highschool - and this may be a stretch for some of you to believe - I think I actually forgot how to spell a 3 lettered word...It only lasted for about 10 to 15 seconds, but I really couldn't think of it.
It was something like fog, or fig. Something like that.
-
I have to say VB.NET now does a little too much for your, especially the My namespace, really that's a little too easy.
Back when i was in VB6 days, and i went to VB.NET, yes the number one question of all time was how do i go Form1.Show
.
But yes, after some time, you're forced to learn OOP, and actually understand that you need to instantiate an object before using it etc.
But in the My namespace, it's like all your forms are handled and managed for you exactly like how VB6 had done it.
Someitmes too much of this ease is a bad thing, it will eventually hit back when people who move from VB6 to VB.NET still won't understand how it all works. -
Some hardcore VB6 loving nut should create a VB6 .NET compiler. The benefits of the framework but the simplicity of the syntax and language.
-
jsampsonPC wrote:When I was starting HTML over a decade ago, I could never remember if the color was "gray" or "grey".
off topic question but why were you using named colors in the first place? even more off topic it just occured to me that my fav grey color is quite humorous in this case #c9c9c9
and YOU CAN get a job with VB.Net..... if you can't I'm not so sure you really want to work for whomever that company might be... shoulda called VB.Net .... VB# or summin so the idea that it is really not any diff than C# in the end mighta rung true with a few of those nah sayers... -
Ang3lFir3 wrote:

jsampsonPC wrote:When I was starting HTML over a decade ago, I could never remember if the color was "gray" or "grey".
off topic question but why were you using named colors in the first place?
"When I was starting HTML". At the time I thought it was neat because you could type:
bgcolor="pig fat vomit chunks"
and get a color. I was too newbish to know that #990000 would render redish, etc. Besides, if I'm not mistaken, some words are universally safe.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.