winforms application not refreshing itself [closed] - c#

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have a win forms application. The form contains a third party chart from dotnetcharting. The form also has a few other controls which allows the user to select the type of chart they wish to see.
The issue I have is when the user clicks the button to plot the chart nothing appears to happen (it is though), so the chart is blank. However when I go to another application, a word document, or web page or whatever and then go back to my win forms application the chart now appears. Why is this?
Is this to do with win forms or the chart? Is there some refresh I need to do?

I think it has to do with the refreshing, please try to put the line:
Application.DoEvents();
after the data is being updated. It should then change the form.

Difficult to say without more information.
Sounds like you have to invalidate the control which sounds odd for a third party control.
Possibly there is a function on the control to tell it to redraw or that you are finished with calculating. Did you check the documentation on usage?
Some controls can be paused from updating the UI to let them handle lots of data and restarted after you finished with the data.
Post some more info on usage and code

Related

How to click OK on messagebox? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to develop a webbrowser application.
When my app clicks on a link, a messagebox pops up with OK and Cancel options. I have to click OK to continue. I tried every possible way to my knowledge with no success.
SendKeys did not work.
I believe if somehow I can switch to the message window, sendkeys might work.
How can I achieve this?
Message Box is a UI element, there isn't an easy way to automate interacting with the message box. There is also the issue of using a Windows message box vs. using a JavaScript confirmation dialog.
Message Box is part of the server execution. It just so happen that in development your server and client are the same machine. So the Windows message box appears on the server (which is your local box.) if you were to deploy this to an actual server the message box would appear on the server, not the user's local machine. That' simply doesn't work for web development.
Now, you could use a JavaScript confirmation dialog. To do this you need to write/render JavaScript to the browser that will open a confirmation dialog when the body of the html is loaded. Not a good idea, but possible. Typically you want to avoid popups and dialogs when a page loads.
So your best option is to either re-design the UI so a message box is not displayed or use a different route to execute the process and bypass the UI altogether.
Assuming you're using the WebBrowser control embedded in a WIndows form named Frm, you could try calling the Activate() and Focus() methods before using SendKeys...
Frm.Activate()
Frm.Focus()
SendKeys.SendWait("{Enter}")
That has worked for me.

The display of certain C# controls is not updating [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I have a C# winforms application which is running correctly on all but two computers. One is my own where every now and then after leaving the window and then coming back to it the controls are not showing on the screen. You can click on them and the events fire, but the area where the controls should be is blank, or looks like the previous window which was on my screen or something like that.
The second computer has this problem once in a while, but the more frequent problem is that when you click on a button you don't see the button change color and when you click on a checkbox you don't actually see the check in the box. Again, the events fire perfectly, but the user can't always tell that the button was clicked or that the checkbox was checked.
Both computers are running Windows 7 and the others are running Windows XP if that has anything to do with it.
I've been Googling forever and can't find anything. Any help is greatly appreciated. Even a decent workaround would be helpful at this point.
Thanks a lot.
The answer was that I was using Form.Close() instead of Form.Dispose() on another form that was opening briefly.

Customizing Outlook Navigation Pane and Forms Outlook 2010 [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have two main issues I am trying to address and after a while searching haven't found what I need to achieve. I have created a custom Outlook AddIn to show information hosted outside of Outlook and Exchange. I can get that working and showing forms but the customer wants tighter integration.
Ideally I want something that shows up in the Navigation Pane like the way the SharePoint AddIn for document libraries does. In that I need to enumerate a treeview based upon results from a WCF call then when the user clicks on an item it opens that and displays entirely custom information retrieved from the WCF service. I have no issue creating the controls and displaying the data but I'm not an outlook specialist. So the key to the question is how do I get the items into the navigation pane (I assume I use the Solutions Module) and then show my form in the right hand side with my data from the WCF?
I have looked all around custom message classes, form regions etc but I don't seem to be able to make sense of that as the items I want to show in the right hand pane don't relate to Outlook message classes.
I can see that I can create a custom task pane and could do the tree view there but don't really want to go down that route. Also I don't want to spring for the AddIn Express stuff as this is just a prototype at the present time.
Sorry for the wordy question but I'm at a dead end.

How can one control third party app which has no API? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need to control some third party app which has no API and very limited command line arguments.
So I need to simulate user interaction using .net and C#.
What I need to do:
start the application (this works)
enter string into appropriate edit
fields
press button
extra bonus is to hide app window
Can this be done and how ?
Thank you very much.
EDIT:
What do you think about AutoIt tool ?
You could achieve this using White.
It enables you to programmatically simulate user interaction with Win32, WinForms, WPF, Silverlight and SWT applications. I used it years ago when it first can out to automate some simple smoke tests on a WinForms application with great success.
(Caveat: this is based on my usage a while ago, so it may be slightly different now)
I created some code to launch my application and find a series of controls by name. Once found, each control could be manipulated (e.g. text entered, button clicked, etc...). To find the name of the controls, use something like Spy++ (Win32), UISpy (WinForms) or Snoop (WPF) to inspect the running application.
Theres also the UI Automation API, which, for this task, would be pretty easy to whip up.
This link will give you an idea of the support for each of the control types:UI Automation Control Types.
You can use the control name, caption or resource ID in order to grab its handle, and do what you want.
Clicking a button can be as simple as grabbing the handle and:
AutomationElement control = AutomationElement.FromHandle(controlHandle);
InvokePattern ip = (InvokePattern)control.GetCurrentPattern(InvokePattern.Pattern);
ip.Invoke();
I've had very good success with this on all .net windows, and 99% of controls from the native world

Paint application in visual C# [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I have created a simple paint application in VC# 2008 with the help of a YouTube video. Its code is as here:
http://paste.pocoo.org/show/268704/
The problem with the code is that if I draw something in the picturebox, minimize the application, and thn maximize it, whatever I had drawn, disappears. The picturebox becomes clear. Why is it so? Plz help me.
You should be doing your painting during the Paint event. This event completely redraws the image. So when you un-minimize the application, the image is redrawn and you don't do anything.
Your application needs to store information about what has been drawn so that it can be redrawn. This is an example of the Model-View-Controller model. The PictureBox is the viewer, the stored information is the model and mouse event listeners will be part of the controller that can make alterations to the model.

Categories