Author Topic: Align One Form to another  (Read 11617 times)

0 Members and 1 Guest are viewing this topic.

Greg B

  • Seagull
  • Posts: 12417
  • Tell me a Joke!
Re: Align One Form to another
« Reply #15 on: November 13, 2008, 01:38:50 PM »


Again, my advice is to put down the attempt to write real software
and spend time learning the basics first. While folks here are glad
to lend a helping hand along the way, they're not going to tutor
you on C#, and that's basically what this thread is becoming.



Well damn.  Shut the forum down Mark.  Seems there is no point in helping people learn any more.

jjs

  • Guest
Re: Align One Form to another
« Reply #16 on: November 13, 2008, 02:17:22 PM »
kind of a catch 22. Can't learn unless there is a resource to learn from. Can't use the resource unless you already know.

Anyways, I got it so that it mostly works.

http://www.olddodgetrucks.com/CS-SingeltonFormAlign.zip

Now how about that lesson on garbage collection?

I will admit I am a newbie at C#. I am porting over the program I wrote in VB6. Seemed like the advice here was to use C# because there was more help available in the forums for C# than VB.Net. Tony, if you think it is too much work to answer my questions, then don't. If I had said, I need a program that draws rooftop units, having the user put in the dimensions in a form and have the color of lines be red, and on layer m-roof. And provided no code and expected a full program, then I could see why you would want to keep harrassing me.

My first hunch was that it was a scoping issue. I had tried declaring the form variable in multiple places, all with the same end result. So I figured I must be doing something wrong. So I came to the place where I know there are knowledgeable friendly people (some that I have known for many years) that might be able to help me out.

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: Align One Form to another
« Reply #17 on: November 13, 2008, 02:26:36 PM »
Mick,

Your avatar/piccy looks suspiciously like the old ABC broadcast logo...or was it when the channel 'went to sleep'...haven't seen that for many years......

not sure if it's the abc one, but yes, I got a bit nostalgic over that one and thought I'd give it a whirl for a while :)
see the comments in red below
Without looking too hard at the code, as Tony pointed out you have a scoping problem.

You are creating the new forms in seperate event handlers/methods and these forms have no scope out side of the method they are defined and created in.
To fix this you need to declare the form var's outside of the methods so you can have access to them at a more 'global' like manner.
Something like -

class TheApp() <<--So I should dim them outside the form? If I do that as a private, tho, then they won't be calleable in the form will they? Scoping issue?
{
// declare them outside of the methods to manipulate them
private Form frm1;  <<--Do I want them dimmed as generic Form type or as the specific form they are suppose to be?
private Form frm2;

public void methodToCreateFrm1()
{
// define frm1
frm1 = new Form(); <<--Do I want them dimmed as generic Form type or as the specific form they are suppose to be?
}

public void methodToCreateFrm2()
{
// define frm2
frm2 = new Form(); <<--Do I want them dimmed as generic Form type or as the specific form they are suppose to be?
}

//once both forms are created you can test for this and align them
void AlignForms()
{
// check for forms first and now do it;
}


hope that helps to understand it a bit better.



Basically yes, while the forms are private, they are visible inside the class they belong to (the App). I just used 'Form' as an example, yes, use whatever form you derived here.

ps. you can derive the form outside of the App though, the App just uses them as member variables like any other 'type'.
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Align One Form to another
« Reply #18 on: November 13, 2008, 05:01:24 PM »

Well damn.  Shut the forum down Mark.  Seems there is no point in helping people learn any more.

Just to help me understand Greg,

can you point out and posts you've made in say the last 200 that actually help solve a problem.


I enjoy most of your posts man, but this is a little off-putting.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Greg B

  • Seagull
  • Posts: 12417
  • Tell me a Joke!
Re: Align One Form to another
« Reply #19 on: November 13, 2008, 05:20:31 PM »

Just to help me understand Greg,

can you point out and posts you've made in say the last 200 that actually help solve a problem.


I enjoy most of your posts man, but this is a little off-putting.


You know what...there is the occasional time that I do help someone.  What I don't do is put someone down for asking a question.

Jeremie summed it up pretty well a couple posts back.

I was very put off by the attitude that TonyT displayed on a forum that is here to help in the learning process.  I know he did help also, BUT to first berate a person then offer advice is not the way to go about it.  Like it was to much trouble for him.

Sorry to put you off, but this was one of the most inconsiderate helpful threads I've read in a long time.  (see how that works?  I apologize, then put people down again)

jjs

  • Guest
Re: Align One Form to another
« Reply #20 on: November 13, 2008, 05:28:33 PM »
In all fairness, this thread has been extremely helpful. I got my problem fixed. :) So all is good. No need for anybody to have hurt feelings.

Greg B

  • Seagull
  • Posts: 12417
  • Tell me a Joke!
Re: Align One Form to another
« Reply #21 on: November 13, 2008, 05:33:01 PM »
In all fairness, this thread has been extremely helpful. I got my problem fixed. :) So all is good. No need for anybody to have hurt feelings.

And with that....I'm off.

TonyT

  • Guest
Re: Align One Form to another
« Reply #22 on: November 14, 2008, 11:26:49 AM »
kind of a catch 22. Can't learn unless there is a resource to learn from. Can't use the resource unless you already know.

http://msdn.microsoft.com/en-us/beginner/bb308891.aspx

Quote

I will admit I am a newbie at C#. I am porting over the program I wrote in VB6. Seemed like the advice here was to use C# because there was more help available in the forums for C# than VB.Net. Tony, if you think it is too much work to answer my questions, then don't.


Ok.

TonyT

  • Guest
Re: Align One Form to another
« Reply #23 on: November 14, 2008, 11:57:01 AM »

I was very put off by the attitude that TonyT displayed on a forum that is here to help in the learning process. 


You seem to have 'help in the learning process' confused with
outright tutoring.

I don't have time to explain the half-dozen things that he
doesn't understand, so that he can understand the simpler
answer to why his code doesn't work.

Of course, if you had the time to go out of your way to
explain the basic concepts and principles of the language
to him in painfully excruciating detail, and terms he can
undersand, why the hell didn't you just do that, which
would have been a much more dignified way of protesting
my attitude.


tjr

  • Guest
Re: Align One Form to another
« Reply #24 on: November 15, 2008, 01:52:54 AM »

I was very put off by the attitude that TonyT displayed on a forum that is here to help in the learning process. 


You seem to have 'help in the learning process' confused with
outright tutoring.

I don't have time to explain the half-dozen things that he
doesn't understand, so that he can understand the simpler
answer to why his code doesn't work.

Of course, if you had the time to go out of your way to
explain the basic concepts and principles of the language
to him in painfully excruciating detail, and terms he can
undersand, why the hell didn't you just do that, which
would have been a much more dignified way of protesting
my attitude.
Good grief, this is asinine. If you feel the questions being asked by someone on this forum is below you, and you can't respond in a manner in which insults aren't slung, then perhaps you should just go away instead of providing a "you suck" comment. While I can't deny you have some serious talent we do have have far better here at the swamp. Guys like MickD, Daniel and cornbread are the type that inspire people to better themselves at coding. Guys like you inspire people wish a method in which you could punch someone in the face through the internet had been invented.