Windows Forms Programs in C# or any other language  

Page 1 / 2
  RSS

Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1602
2019-06-29 11:56 pm  

Does anyone write Windows Forms Programs using C# or any other language?

If so, what language do you use and what IDE or studio do you use?

 

DroneBot Workshop Robotics Engineer
James


Quote
jscottbee
(@jscottbee)
Estimable Member
Joined: 10 months ago
Posts: 121
2019-06-30 1:44 am  

It's been a long time since I did any win forms, all C#. I had a couple of large apps back in like 2004, they are now WPF and I only support the backend (Yah!) I did do a largish personal app in C# under Mono, but ended up moving it back to Tcl/Tk. This was all long ago I know.

Scott

 


ReplyQuote
jrbdeveloper
(@jrbdeveloper)
Active Member
Joined: 3 months ago
Posts: 14
2020-01-22 12:23 am  

Last time I wrote a winforms app it was a code generator for web apps; all c#. I currently write business apps and RESt services in .net core, c# of course in visual studio 2019.

The unexamined life is not worth living - Socrates


ReplyQuote
frogandtoad
(@frogandtoad)
Reputable Member
Joined: 10 months ago
Posts: 384
2020-01-22 9:13 am  

@jscottbee

I too used Win Forms a long time ago, and likewise mentioned in a recent thread that WPF is the preferred choice these days. Certainly, WPF is a little more difficult to grasp, as it forces you to think ahead for your layout design. Although it is very similar to using a .CSS stylesheet for it's form components layout, I do see it's benefits when it comes to dynamic presentation of its content!

Cheers!


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1602
2020-01-22 10:33 am  

@frogandtoad

WPF is basically mandatory if you are going to write programs for use on the Internet or on other devices that may have different screen layouts from a Windows PC.  But as you say, it also requires quite a bit of changing things around in terms of layout design.   Also WPF doesn't support Child Forms which I'm using extensively.

Here's a screenshot of my program:  The  Program is currently unfinished.  But each child form is basically an independent application.   Well, they are all independent in the sense that they don't necessarily depend on each other, but they are all able to communicate with each other.  And the Parent Form oversees all the Child Forms.

Overseer

In addition to all the child forms being children to the Overseer Form they are each given their own sub namespace.    And as you can see in the solution explorer menu they are also each stored in a separate folder on in the directory on the disk.  This make it nice if you want swap out a child for a different version which I tend to do a lot as I try different things.

Solution

Something similar could probably be done using WPF.  But since I have no need to put this program on the web or run it on anything other than a Windows machine I don't have the incentive to move over to WPF.   I would also lose the Parent/Child relationships.  I would imagine there would be some other way of doing something similar using WPF,   But since I already know how to do what I'm doing and I would need to start all over again from scratch to switch over to WPF I don't have a lot of incentive to do that.  Putting this program on the web has no practical value since it's basically customized for my robot anyway.   It's not going to work for anyone who doesn't have my robot.  Unless they go in and change up a lot of the code to suit their  robot.   But they couldn't do that on the web anyway.

I'm working toward making a video of how I'm writing this program and what it does.  But my video making capabilities here are extremely limited at the current time due to circumstances beyond my immediate control.  The idea being that anyone who follows the build can modify the code to match what they are doing with their robot.  So they could customize this for their own purposes.  I would also encourage others to use different methods that work for them, like using WPF instead of the standard Windows Forms.  The only thing that would change there would be the exact design of the windows.   They would also need to figure out how to get past the lack of the Parent/Child relationship in WPF that I am using with the standard Windows Forms.   As I say, there are probably ways of getting around that.

I would also encourage others to write a similar program using Python and perhaps its GUI capabilities with Tkinter?  Or whatever they use.   I would imagine that similar things can be done in other languages and platforms.  Maybe someone could do it with C++?  I don't know how to write GUI programs using C++.  Another language that could surely be used would be VB or Visual Basic.  That should be real easy to do.

DroneBot Workshop Robotics Engineer
James


ReplyQuote
frogandtoad
(@frogandtoad)
Reputable Member
Joined: 10 months ago
Posts: 384
2020-01-22 10:49 am  

@robo-pi

Posted by: @robo-pi

WPF is basically mandatory if you are going to write programs for use on the Internet or on other devices that may have different screen layouts from a Windows PC.

Yes, that's true... but it is the replacement for traditional windows forms.

Posted by: @robo-pi

Something similar could probably be done using WPF. 

Indeed, WPF doesn't give you that traditional MDI container, but you can do well without it, and I think there are some libraries/frameworks that work around it, but I wouldn't bother with them.  Microsoft have taken and recommend the WPF route, so I'd be sticking with that, because as you know... they will eventually pull windows forms from their future plans.

Posted by: @robo-pi

I would also encourage others to use different methods that work for them, like using WPF instead of the standard Windows Forms.

Exploring different methods is always good, and a learning experience.  I recently downloaded and started to use Processing, and being able to connect it to Arduino serial (just as with vpython) is a great tool to visualise and experiment with your data and specifically algorithms.

Posted by: @robo-pi

Maybe someone could do it with C++?  I don't know how to write GUI programs using C++. 

You can write GUI programs in C++ under Visual Studio too!

Cheers!


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1602
2020-01-22 11:26 am  
Posted by: @frogandtoad

You can write GUI programs in C++ under Visual Studio too!

This is where it would be nice to have access to a teacher. ? 

I'm running Visual Studio 2017 and I didn't see any easy way to write Windows GUI Forms using C++.

In C# the Windows Forms programs are offered up, and when you get into the studio there is a Design tab that brings up the form to build.

I didn't see that feature being offered in the C++ options.

DroneBot Workshop Robotics Engineer
James


ReplyQuote
frogandtoad
(@frogandtoad)
Reputable Member
Joined: 10 months ago
Posts: 384
2020-01-22 11:36 am  

@robo-pi

Posted by: @robo-pi

I'm running Visual Studio 2017 and I didn't see any easy way to write Windows GUI Forms using C++.

Microsoft removed the module to encourage people to use C# and VB.NET, so you have to select the option from the installer when you install it... you should be able to rerun the installer and select the  C++ desktop module for windows applications.

Cheers!


ReplyQuote
frogandtoad
(@frogandtoad)
Reputable Member
Joined: 10 months ago
Posts: 384
2020-01-22 11:44 am  

@robo-pi

Here is a view of mine - VS 2017:

image


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1602
2020-01-22 12:29 pm  

Oops!  My mistake.

It's a long story. ? 

I'm actually running both Visual Studio 2017 and an Sharpdevelop 5.1.  If you're not familiar with Sharpdevelop it's basically the same Windows Studio 2017 but runs a lot faster on old slow computers.

There was no Windows Forms offered in the C++ on Sharpdevelop.  So I chose to use C#.  That's where I started.  Then I downloaded Windows Studio 2017 because I wanted to be sure everything was the same.  The reason for this was for making videos.  I figured that more people would be familiar with Visual Studio than with Sharpdevelop which is considered by many to be dead and obsolete.

However, to save space on my computers and I chose not even download C++ at all since I'm not using it.

So that's why my Visual Studio doesn't offer the option.  I chose not to include C++ at all. ? 

Well, at least I learned something today.  Now I know that C++ on Visual Studio does offer Windows Forms after all.   But since I'm already using C# there's no point in switching over now.

DroneBot Workshop Robotics Engineer
James


ReplyQuote
jrbdeveloper
(@jrbdeveloper)
Active Member
Joined: 3 months ago
Posts: 14
2020-01-22 7:47 pm  
Posted by: @robo-pi

Well, at least I learned something today.  Now I know that C++ on Visual Studio does offer Windows Forms after all.   But since I'm already using C# there's no point in switching over now.

I wouldn't bother with trying to work with c++ in a WinForms manner given that c# is a better language. I mean that from the perspective that it offers more by way of OO design principles (interfaces and classes, Abstracts and Partials). Given that most of my work is in the web world with .NET Core C# and REST services I'm not too familiar with WPF. My only advice would be to be careful not to trap yourself with a technology that will eventually be unsupported. Both in terms of revision updates and well as the operating system it will run on. It used to be modern to use ActiveX controls in Visual C++ and VB but mostly those things wont operate on current versions of Windows.

The project looks interesting, you might consider using GitHub for source control even if its only you working on it. I'm sure the codebase in growing larger and larger so having a way to roll back changes in the event you break something after an hour of modifications where you forget everything you touched. Also, it would provide a way to better collaborate over the code with others, and you never know... While it may be specific to your implementation, if its developed in a modular way someone could come along and fork your repository and modify it for their needs.

Im doing just this for code that Im working on for a couple projects. My goal is to make it generic enough that it can be used by n-number of projects like it. https://github.com/OpenArduinoProjects if you're interested.

I'd love to take a peek at what you have going on.

 

The unexamined life is not worth living - Socrates


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1602
2020-01-22 8:43 pm  
Posted by: @jrbdeveloper

I'd love to take a peek at what you have going on.

I'd love to share what I'm doing as well.   I have no secrets to guard.   Anyone is welcome to use what I've done thus far in anyway they so desire.  I don't have a whole lot of code written because I spent a lot of time getting the main structure organized as a "learn-as-you-go" basis.   Every time I wanted to do something I had to do a lot of Googling and asking around on forums.   I received a lot of suggestions that I simply couldn't understand. ? 

I'm not a professional programmer.   I'm just a hobbyist.  I have ideas of what I want the program to do.  Basically it's several programs in one.  I could have made it a lot simpler just writing a bunch of individual programs, but I wanted them to be able to communicate with each other so I ended up with the Parent/Child situation I currently have.  So far it seems to be working out pretty much as I had hoped it would. 

I call the parent form the Overseer.  All it does it manage all the child forms keeping track of which ones are open, hidden, or closed, etc.   It also serves as a "Post Office" for communications between all the individual child forms.

The Child Forms are the individual apps that actually interface with the robot.

They are as follows:

Robo Pass - Serves as a communications channel from the laptop computer to multiple robots.

Navigation - Serves to draw out floor plans on the laptop as the robot discovers them.

Arm Control- Serves for prototyping and limbs added to the robot.

Voice Speaker- Serves for prototyping how the robot speaks including manipulation of the face, etc.

Voice Recognition- Serves for prototyping the voice recognition skills of the robot including Semantic A.I.

Automation- Serves for prototyping automated tasks the robot has learned.

All of the above are just prototyping tools for the robot.  It is true that this collection of programs could control the robot remotely, but that's not the purpose.  Ultimately this program is just for prototyping the software that will eventually be transferred over to the robot itself for complete autonomy.   So this entire program is just a prototyping tool because, IMHO, it's way easier for me to prototype the robot sitting at a laptop than to try to keep uploading software to its onboard SBCs to see how well it works while I sit in the dark.

With this overseer program I can dynamically see what the robot is doing from the laptop and I can more easily interrupt things and change up the programming on the fly as I develop the robot.

So this is the idea behind the program.  It's intended as a prototyping tool, but could be used to control a robot remotely from a laptop is someone wanted to use it for that.  In fact, in the early going that's basically what I'll be doing as the robot won't be autonomous right off the bat.   It will slowly become more and more autonomous as I move little bits of coding over the robot side as the project grows. 

As an example.  In the early going I will need to baby-sit and teach the robot how to successfully navigation throughout the house and be able to know which room it's in and how to navigate to any other specific room.  But once I have it doing this, that programming will be transferred over to the robot internally.  Then instead of having to help it move from room to room I can just say "Go to the Kitchen" and it will know how to do that. ? 

Today I'm working on an inertial guidance system for the robot.   I don't need the Overseer program to do this as I'm building this inertial guidance system right into the robot itself.  So I'm not even working on the Overseer program currently.

But I would like to make some videos on how I got it up to where it currently is.  I already have a GitHub site, so I can put the code up on there as well.   I imagine that a lot of things I'm doing may not be the preferred way to do them.   So I am looking for feedback, but at the same time I confess that I also fear that people might start telling me that I'm doing it all wrong. ? 

But we'll see how that goes.  I'm going to try to make a video here.  In fact, I'm already trying, but things are working out very well.   I basically have JUNK computers when it comes making videos.

DroneBot Workshop Robotics Engineer
James


ReplyQuote
Duce robot
(@duce-robot)
Reputable Member
Joined: 9 months ago
Posts: 422
2020-01-23 5:04 am  

I hope to be able to write my own programs some day these are pretty cool just got to the 4 video in Paul's tutorial you were right he is teaching it pretty good though I'm going to have to watch each one fifty times to learn it.and I ended up getting the antenna headless mode seems like it has so many possibilities I don't know where to start so I'm waiting lol? open CV sounds fun but that's next .man I can't wait to see some of this stuff in action you already have 2 robots up and running do you have a nano on one? If so what kind of battery powers it .  Seems like it can draw a lot of power.?


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1602
2020-01-23 1:14 pm  
Posted by: @duce-robot

you already have 2 robots up and running do you have a nano on one?

No, my current robots are too small for a Jetson Nano.    I also don't consider them to be "up and running". ?   They are coming along.   I can send them an automated sequence of commands from the Overseer program I mentioned above.   But they are still lacking a lot of capabilities.   I'm currently working on building an inertial guidance system for them.   This system will be totally onboard the robots.   It will become a feature of the robot.  This way when I tell the robot to go straight from the Overseer the robot will be able to do just that.

Everything takes me forever.  I have the code working, I actually used Bill's Arduino Level Project and converted that to an inertial guidance system.  I have it up and running but I need to convert it over to a library and I'm having some problems with that.  It seems like it's all these little things the keep holding everything up.  I should have been done last night but for some reason it's not recognizing that variable shave been declared.  But they are declared in the header file.   So it's one of those things where everything appears to be correct, but the compiler still complains and won't compile.   All it says is that the variables aren't defined.  But as far as I can see they are defined.   So what do you do now?

DroneBot Workshop Robotics Engineer
James


ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer Moderator
Joined: 10 months ago
Posts: 1602
2020-01-23 1:18 pm  

Question on Visual Studio 2017

Does anyone know how to back up an entire solution?  I can't find anything in Visual Studio to make a back-up copy of the entire solution.   So what I've been doing instead is going into Windows explorer and just backing up the entire solution directory.   That does work.  But it seems to me there should be a way to back up the solution from within Visual Studio.  There probably is a way to do this, and I just don't know where to find it.

DroneBot Workshop Robotics Engineer
James


ReplyQuote
Page 1 / 2

Please Login or Register