1

I used to programming in Java but I am looking at moving to VB.NET for some things. I have Visual Studio 2010 Express which I know has a form designer, but I don't like using them for commercial applications because components sometimes don't look like they are aligned properly, or don't resize properly etc. So really what I'm asking is, is there anyway to create a GUI like you do in Java (with LayoutManagers and things)?

Also, whilst I'm on the topic, is it compulsory for me to purchase Visual Studio in order for me to be allowed to develop and sell commercial applications?

Thanks in advance

2
  • 4
    The free version (Visual Studio Express) can be used for commercial applications, without restriction. Commented Jul 23, 2012 at 20:18
  • If you really want, you can write the code to initialize your controls manually, but, apart for trivial code, it don't worth it. Use the designer with confidence. It works great. Commented Jul 23, 2012 at 20:20

2 Answers 2

1

Creating a GUI like Java is really outdated...

Take a look at WPF!

Using WPF, you can create your GUI with XAML. You will find this very similar to using layoutmanagers etc (I also made this exact same choice a few months ago)

Don't know why you should buy VS, sorry.

reference: http://msdn.microsoft.com/en-us/library/aa970268.aspx

bonus: if you can work with WPF, you can work with Silverlight ^^

Sign up to request clarification or add additional context in comments.

6 Comments

Side note on that bonus: I would highly recommend adopting Silverlight instead of WPF mostly because of Silverlight's drive toward light framework libraries and asynchronous code. Silverlight itself may not be going anywhere, but those same .NET coding practices are the foundation of WinRT and Metro app development.
However, WPF is easier to step into (imho) :)
Yes - WPF does look rather cool. No worries about paying for VS, egrunin answered that question. I'll look into it a bit more when I'm nearer to using it, but at least I know what I want to do is possible now!
not to be greedy ... but it would be kind to mark this as an answer (if this answer suited your needs that is ^^)
I know - and I was going to ( I still am ). I just had to go out and I wanted to see the answer to the comment I put on David's answer. Thanks again
|
1

You certainly can lay out all of your code by hand if you like. As a matter of fact, in Visual Studio, if you create a form, it will have a corresponding Designer class that has all this code.

Example:

  • Form1.vb
  • Form1.designer.vb

*Note - you ned to click the "Show All Files" button above the Solution Explorer to see these files.

If you look in the designer class, you can see all of the control properties. (textBox1.Size, textBox1.Location, etc.) (see screenshot below)

However, that is really the hard way to do it. Visual Studio does have auto-snap features, and buttons that let you align controls and align top, middle, bottom, left, right, etc. so aligning properly isn't an issue.

You truly do get absolute control using the designer. That goes for the free versions as well as the spendy.

enter image description here

5 Comments

Thanks for your answer as well. I guess you've all got a point about coding the form is just making more work for yourself. However, I've just had a quick play with three buttons but none of them moved or resized - do I need to do something extra?
You need to work with anchor points (also in the properties) The designer is great, certainly for the time it was released. I still recommend WPF... WPF is the successor of WinForms one might say... as Metro will probably be the successor of WPF :-) Also .. WPF is absurdly flexible.
@Yoeri has a very good point about WPF. WinForms apps will likely be around for a long time, but as we go toward more of a mobile/tablet environment, WinForms will be less common, and only used when there's some sort of absolute need for it. Right now, 95% of my work is ASP.NET, and that 5% is only used when I need to access a COM port on the client, or something not possible with a web app. I'm not sure investing time learning WinForms is time well-spent long term, unless you have a need. I don't know your situation, though.
@Andy - Personally, I'd start here if you want to learn WinForms: windowsclient.net/learn/videos.aspx and in particular, start with the last video on the page (specifically about layout): windowsclient.net/learn/video.aspx?v=3956
Thanks for that information - really helpful. Based on what has been said here though, I think I'd start with WPF! It's really hard to chose which answer to accept because they are both so good, but I think I'll accept Yoeri's and upvote yours.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.