• (2 Pages)
  • +
  • 1
  • 2

Passing Data Between Forms Rate Topic: ***** 1 Votes

#16 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3488
  • View blog
  • Posts: 11,902
  • Joined: 12-December 12

Posted 09 November 2013 - 10:46 AM

The vast majority of questions on this forum, and others, is still about WinForms, not WPF. Similarly, communicating between these forms is a very common question. The idea that a rookie would be data-aware (or even database-aware) enough to begin their journey at the level that you indicate is unrealistic. How would such a tutorial go? What level of understanding would the reader have to already have before they could follow the tutorial?

We are talking about rookies. They have to start somewhere ;). The approaches I outline in my tutorial are still a major step away from TextBox1 talks to TextBox2 on Form2. I hope that it also, to some extent, leads the reader towards the concept of data-objects (data-binding, the Entity Framework, etc.).

This post has been edited by andrewsw: 09 November 2013 - 10:50 AM

Was This Post Helpful? 1
  • +
  • -

#17 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5529
  • View blog
  • Posts: 11,843
  • Joined: 02-June 10

Posted 09 November 2013 - 06:13 PM

You're not wrong. And I didn't mean to sound like I was saying "You shouldn't have written this", if that's the way it came out. The tutorial absolutely addresses a large number of questions we get and certainly will be something I link to rookies asking these basic questions.

WinForms will remain the majority of questions for us for YEARS to come, because the base of established users will outnumber the users taking up the new technology. Plus books on WinForms are more plentify. Plus tutorials elsewhere are more plentiful. Plus schools have established curriculums based on WinForms. There is a lot of WinForms inertia in place.

By the same token, there are still a large number of Visual Basic 6 questions that get asked, despite it being a 10 years dead language. That doesn't mean it is a technology I would recommend to someone to start picking up today.

But that doesn't change the fact that WinForms is the old technology. I just went through a change of employment. I spent 9 years with a company doing WinForms, with the last two as a move over to WPF on a slow and limited scale. EVERY prospective employer wanted at least 5 years professional experience in WPF, solid testable skills in MVVM, experience with control templates and data templates.

I'm not saying this is a bad tutorial. I'm not trying to chastise you. I'm saying it is a good tutorial. But I would have felt remiss if I did not point out to those same rookies this targets that WPF, not WinForms is what is going to get them the better job with more future in it.

Since it is *all* equally new, why not start with proper WPF/MVVM, especially since it is the right GUI-to-Data model? Learn the right thinking from the start and you don't have to change and unlearn later.

Think of it like learning to drive. If you learn to drive a stick-shift pickup you're golden. Going to a motorcycle is the same manual shifting concepts. Switching down to an automatic compact is easy. But if you learn on an automatic compact, you have to learn new skills to drive the stick-shift, and unlearn the thinking of how small your car is when you move up to a big truck.

I didn't mean to hijack the thread so let me end on this... This is a great tutorial for a subject we get lots of questions about. And for anyone reading this: If you are in school learning WinForms then this is very much exactly what you probably need, in a well explained way. Andrew knows his stuff so listen to him; and if you are still in WinForms then this should help you a lot.
Was This Post Helpful? 1
  • +
  • -

#18 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3488
  • View blog
  • Posts: 11,902
  • Joined: 12-December 12

Posted 10 November 2013 - 04:11 AM

View PosttlhIn`toq, on 10 November 2013 - 01:13 AM, said:

You're not wrong. And I didn't mean to sound like I was saying "You shouldn't have written this", if that's the way it came out. The tutorial absolutely addresses a large number of questions we get and certainly will be something I link to rookies asking these basic questions.

No, that's fine, I didn't mis-interpret what you were saying, and I understand the points that you are making.

I didn't want the reader to be confused though, or to think that this tutorial could have be written in a different way - covering the same points, and at the same level.
Was This Post Helpful? 0
  • +
  • -

#19 Michael26  Icon User is offline

  • DIC-head, major DIC-head
  • member icon

Reputation: 358
  • View blog
  • Posts: 1,525
  • Joined: 08-April 09

Posted 10 November 2013 - 07:59 AM

They don't have to spend 10.000 hours to learn old technology, but just enough to maintain legacy application, old technology like WinForms isn't gonna disappear just like that lots and lots will need to maintained and someone needs to do it.
Was This Post Helpful? 1
  • +
  • -

#20 bergeronjc  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 19
  • Joined: 29-October 13

Posted 13 November 2013 - 11:40 AM

So this is all vastly interesting and I was getting everything, even debugging some of my mistakes until the end with the color change.

Dim ColorValue As Color


The error says: Structure 'Color' cannot contain an instrance of itself: 'Color contains 'Color' (variable 'ColorValue').
The error correction options give me: Change 'Color to 'Drawing.Color' or Delete the line of code.

If I change to 'Drawing.Color' all of the Dim Colors() in frmChildColor get an error that states:
'Red' is not a member of 'Passing_Data_Between_Forms.Color'. (and the same for blue and green with their names in place of red).

So from that error correction I choose 'generate a field' for each color because it asks me if I want to generate a method stub or a field. However when I run the program clicking on the colors does absolutely nothing.

I am guessing that it doesn't know I want to change the background color or how it should change it based with the code presented. Is that true? If so how should the code read?
Was This Post Helpful? 0
  • +
  • -

#21 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3488
  • View blog
  • Posts: 11,902
  • Joined: 12-December 12

Posted 13 November 2013 - 11:45 AM

I deliberately named the structure Colour with a u (UK spelling) to avoid such issues:

Public Structure Colour
    Dim ColourName As String
    Dim ColourValue As Color

    Public Overrides Function ToString() As String
        Return ColourName
    End Function
End Structure

Was This Post Helpful? 1
  • +
  • -

#22 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5529
  • View blog
  • Posts: 11,843
  • Joined: 02-June 10

Posted 16 November 2013 - 06:57 AM

View PostMichael26, on 10 November 2013 - 08:59 AM, said:

They don't have to spend 10.000 hours to learn old technology, but just enough to maintain legacy application, old technology like WinForms isn't gonna disappear just like that lots and lots will need to maintained and someone needs to do it.


I guess that's the real question then... Do you want to be the guy that gets hired to maintain legacy projects, or do you want to be the guy whose skill-set puts them on the team for forward-thinking projects.

And frankly, there are so many people that have been doing WinForms for decades there won't be a shortage of people to do maintenance. Trying to add yourself to that pool is just silly. A working knowledge is good. Most likely the company with the legacy programs already has a team of legacy people to maintain them. As the new projects replace the old projects the people will either further their skill to move with the new technology, or the legacy coders will leave one by one as their projects get mothballed, for other legacy support positions.
Was This Post Helpful? 0
  • +
  • -

#23 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3488
  • View blog
  • Posts: 11,902
  • Joined: 12-December 12

Posted 16 November 2013 - 09:51 AM

Quote

As the new projects replace the old projects

This seems to suggest that companies are, en masse, migrating from WinForms to WPF, and that no new projects, or major projects, will be started with WinForms. Do we know this to be the case? Are there any resources that would tell us how quickly WPF is being adopted, and WinForms being side-lined?

I don't know myself, but I would be interested to discover such statistics.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2