Totally independent forms in tabcontrol - vb.net

I'm designing an application on VB.net and I'm newbie as well.
I thought about the general architecture of the application and came up with the following idea.
the application is made of different modules
the user can run different modules in the same time
each module will run his main form in a different tab in tabcontrol
each module has his own modal forms, mode-less windows, messages, ... etc.
Before going through much development details, I started first with trying this design. Though, I couldn't first embed dynamically a form in tab during run time and even after some workarounds, I couldn't make the modules run perfectly in parallel. For example when I have a modal window displayed in a module, the whole application freezes while I expect only the related tab to freeze and be able to switch to the others to do some work.
Does anyone know how to make the tab contents completely separate and not have one freezes the other?
Thank you.

There's no need to have separate modules/forms to run more than one task simultaneously. The issue you are having with the UI freezing is you are running all operations on the primary thread. You need to multithread the application. Do a quick search on stackoverflow for multithreading vb.net. If you can't find anything let me know and I'll do the search and provide links.

Related

Issues about placing controls out of the form?

I want to know if is a problem for my users, me, stability, or my VB .NET program when controls like textbox, development buttons or dev tools are placed out of the form body (by extand for using tools, and reduce before publishing).
Controls are enabled = false, or hidden but necessary for my program run flow.
This is a technique that used to be common, and even today I'm not aware of anything about it that will actually break anything: winforms is perfectly happy to let you position items out of the visible area.
But it's a little unusual to see anymore, because we have better tools for managing this.
I'll add a note about remembering to call SuspsendLayout() before changing a bunch of controls to reduce flickering, and ResumeLayout() when finished.

Changing application layout via buttons in VB .NET

Currently I would like to program an application gathering forms that are callable with buttons on the side. For this, I am using the latest build of Visual Studio Community. One way I thought of would be to literally put all the form elements (textboxes, lists, etc.) in the application window and only enable them whenever the according button is clicked on. However, if this is the way to do it, I find it quite messy and unpractical, and I'm pretty sure there's another way around.
After some research, I have learned about the MDI layouts, but they don't suit my taste. I would like to keep everything in one single frame.
Could you give me a hand?

SendKeys VB.net

Hi ive developed a application that works with my site by using
SendKeys.send("{ENTER}") to submit info on one of my forms.
Is there a way to stop it from running outside the application?
For example im trying to run the program in the background and when im browsing my facebook or on google it randomly keeps hitting enter.
Any help is greatly appreciated thanks for your time.
The short answer is to look at the windows available for a process and check the titles to see if it's the page you want.
If System.Diagnostics.Process.GetProcessesByName("firefox").MainWindowTitle = 'My Page Title'
...
End If
That said, there are much better ways to do this - If you're using firefox, look into GreaseMonkey, if in Chrome, look at TamperMonkey.
Both allow you to inject custom javascript into any page whose url matches a pattern you choose. In effect, you could write some Javascript to submit a form (say) 30 seconds after page load.
This would have the benefit of working if a different tab is selected as well as not requiring a whole application.
The SendKeys.Send method will indiscriminately send the key stroke to the active application. There is no way to use this API to target a specific application.
You could change your app to try and verify the active application is the one you want to send keys too. This is destined to be a flaky process though. No matter how good your verification is it's always possible that the active app is switched to another app after your verification completes.
If VerifyActiveAppIsTarget() Then
SendKeys.Send("{Enter}") ' Active app could change before this runs
I would persue a different solution for sending data between my apps

Forms open and load very slow. Sometimes they won't open

I have a relatively small VB winforms project.
It is currently used to launch numbers hyperlinks and some apps on a server.
There are a couple functions that do all the work, but the it really boils down to:
System.Diagnostics.Process.Start("iexplore.exe", urlVar)
or if it is an app sitting on the server, the variable passed into the function appLinkVar will contain the need file path to launch the application.
System.Diagnostics.Process.Start(appLinkVar)
The "items" are stored on a SQL Local Database (.mdf)
Id, appName, appLink, appClickCount, appFavList,anddecision, which tells the function if it is calling a website or opening an executable.
Currently, there are forty rows in the database and I project 150+ in the end that need to be updated centrally and often (weekly). But that's a different question for later. The reason I added in it in this question was for insight as to why I am using a database instead of a Setting or XML file for some links. (better suggestions welcome)
My admin main form loads Visible = False and loads the icon in the system try. So you can't actually see the first form that opens. It is a hidden admin window and it's main purpose is to put the icon in the system tray. The green RJ icon - http://snag.gy/VBa6c.jpg
Then all of the app interaction is around the notify icon. Example: the app loads on hover. right-click for settings and options etc.
Once the primary form loads, on mouse over the "Primary Label" for example and the white form to the left appears and so on. Not much to it. http://snag.gy/excKr.jpg
The Frequently Accessed items is currently stored on the database called appClickCount, this will be coming off of the database and to another recommended way of storing the data. But when I initially added the database, I noticed some lag in the main form loading. It would take it 5-7 seconds to populate the Frequently Accessed Items List and so on. So I changed the code from mainWindow.show() to mainWindow.visible(). Worked great for me. opened and closed very quickly. But after some use today by a tester, the application became almost unresponsive. He clicked on the notification icon numerous times and the app failed to load. Then threw a SQL time out error. It was the end of the day and I couldn't grab a screenshot.
I need to make this more reliable.
After some discussion the other day on SO, I was talking to someone that recommended I re-write the app in C# WPF, and that is definitely the plan. But I need this thing to past testing as is in VB this week. Where can I start troubleshooting the delay in opening? What other suggestions do you have to improve the application? Do I need to have an invisible form load first so I have access to a system tray icon or is there a better way?
I have talked to quite a few people on here lately and got some really good advice, I figured I would lay it all out here and see what input you guys can give a new guy... I'm also gonna go hang in the C# room for a little bit if you have any further questions.

Surface Table Project with Web Browsers

I'm working on a project that will use a Surface table to show web browsers that can be manipulated via the multitouch behaviors. I'd like to be able to show a browser at full screen and then resize, move, etc.
I'd also like to be able to launch a new, separate browser windows that can also be manipulated through multitouch.
Any suggestions on controls to look into for this?
Thanks!
This is a non-trivial task. As far as I know, many have tried and put months of effort into it but none of been very successful. Don't even bother trying to get something to work well based on WPF's built in WebBrowser control. Best bet is to start with the SurfaceScatterView control and trying to put a 'Chromium' control inside of it (http://wpfchromium.codeplex.com/). It appears that even this isn't straightforward though: http://wpfchromium.codeplex.com/discussions/244117