For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
Hello to all,
I'm writing an application using C# in VisualStudio 2008 for Windows Embedded Compact 7 operating system, that is a SmartDevice application.
I have a Form and a UserControl.
In the Form load event I create a UserControl instance and I put it in the form:
privatevoid Form1_Load(object sender, EventArgs e)
UserControl1 uc1 = new UserControl1();
uc1.Parent = this;
uc1.Location = new Point(607, 350);
I want also to write a string in the UserControl from Form1.
I tried writing the following function in the UserControl:
publicvoid SetText(String testo)
gr = CreateGraphics();
Font f = new Font("Tahoma", 14, FontStyle.Bold);
e = new PaintEventArgs(gr, ClientRectangle);
SolidBrush br = new SolidBrush(System.Drawing.SystemColors.ControlText);
StringFormat sf = new StringFormat();
sf.Alignment = StringAlignment.Center;
Rectangle centered = e.ClipRectangle;
centered.Offset(0, (int)(e.ClipRectangle.Height - e.Graphics.MeasureString(testo, f).Height) / 2);
e.Graphics.DrawString(testo, f, br, centered, sf);
I think the problem could be in the PaintEventArgs: when I work inside the UserControl Paint event I have the "right" PaintEventArgs objec, when I try to write my string from Form1 I'm not able to point to the "right" PaintEventArgs.
Obviously my suspicion can be wrong.
I don't know how to solve this problem, someone can help me?
You do NOT put the Graphics and Drawing code in SetText. That goes in the Paint event of your UserControl.
SetText should only set a private field that contains the text to paint and then call Invalidate on itself to get the control to repaint itself.
Your code also leaks resources badly. You're not calling Dispose on the GDI objects (Graphics, Brush, Pen, ...) that you're creating. You'll eventually run Windows out of handles and it'll start acting weird and crash.
After upgrade to VS 2017 i got "Error An error occurred while signing: SignTool.exe not found." But only using MSbuild on the Visual Studio publish there's no problem.
I already checked folder "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin" and in fact there's no SignTool.exe present. But there was before installing VS2017, any ideas?
I have an Application which runs fine and gives perfect results when the Application runs with right click and Run as Administrator option, but when I try to run the application a batch file or Scheduled task (even though I selected option of Run with highest privileges for Scheduled Task) still it runs as I am running without Admin Privileges.
Is there any way I can run the Application same as "Run as Administrator" and can schedule it as well. Tried different approaches nothing worked so far. Any help would be really grateful. As the application is not giving 100% results, people are thinking that Application is not working properly.
Any help can help me, thanks in advance.
I have few questions about it, the Application is actually calling SSIS Packages running good for some Packages but for some its not, Application executes the SSIS Packages but when the Package itself doesn't completes it fully. Because of this I am getting doubts like
Does SSIS Package which runs from within C# code, does it run with the same Privileges as then Windows logged in account or different account? If its different account what account it runs with?
"There is already enough hatred in the world lets spread love, compassion and affection."
You need to use a translation service, which would read the Tamil words and then generate English, or Thanglish for them. No framework, — ASP.NET, PHP, Node.js even Java EE — is capable of doing this all by themselves.
You can use services by either Google, or Microsoft and then write your own service that converts the words. Which is beyond the scope of these discussions. Both of these giants provide some good APIs that you can subscribe to,
I want to get the current week of the month in string, like for example I want to check if this current week is the first week of the month, second week of the month like this is it last week of the month. Usually I am not having problem in finding if this week is first, second, third or even 4th but the problem is in finding which is the last week.
Any help is going to be greatly helpful - thanks in advance.
"There is already enough hatred in the world lets spread love, compassion and affection."
Sorry I was busy in other stuff and with my kids, yes I came back, yes I did my friend. It was more logical but I want to do it.
Here it is.
public static bool RunForTheDay(bool IsTheJobWeekly, bool IsTheJobMonthly, bool IsTheJobYearly,
int WhatDayOfMonthJobRuns, int WhatWeekOfMonthJobRuns, int WhatMonthOfYearJobRuns,
int WhatDayOfYearJobRuns, bool RunForTheDay, string strDayOfTheWeek)
bool retRunForTheDay = false;
I have a fairly simple VB.Net application which I wrote a few years ago to chart weather observations. It uses two DateTimePicker controls to specify the date/time range of the data to be charted and had been working fine, once I got a few initial minor bugs sorted out. I don't use it that often (perhaps once every 3-6 months), so I don't know when the behavior I am about to describe started. A couple of days ago, I ran the application, and, instead of defaulting to displaying the beginning and end of the most recent 24 hours for which data was available (e.g. 04/18/2017 12:23), both controls displayed only the delimiter characters (// : ). The values of the fields were apparently correct - choosing a data set and pressing the 'plot' button produced the expected plot of 24 hours' data - but the datetimepicker controls didn't 'work'.
Debugging with Visual Studio confirmed that the contents of all the variables were as expected, but the controls still looked (differently!) weird in the running program, although they looked as they should in design view. Running under Visual Studio, the controls sort of worked, but with an enormous amount of horizontal space (and no delimiters) between each subfield (month, day, year, minutes, seconds), so that only one or at most two subfields were in view at a time.
Has anyone seen anything like this and/or does anyone know what may be going on.
There was a similar question posted yesterday, but I cannot recall where it was (can't find it in the obvious places). Someone suggested checking the code to see if some control information is being garbage collected early.
Thanks for the pointer. As you imply, though, other than reassuring me that 'I am not alone', the C++ thread doesn't seem to help. The OP in that thread seems to have seen the problem just after applying the Win 10 Creators Update, which is when I, too, saw it, but I can't imagine why a change in garbage collection could be relevant in my case. I will look again at the code with that potential issue in mind, but I doubt if I will find anything.
I have looked at the code. It is a single Form Application and there is nothing even remotely related to the problematic DateTimePickers that should be going out of scope unless/until the Form is closed.
If you had read the second paragraph in my original post, let alone the thread that Richard pointed to, you would have seen that almost the first thing I (and the OP in the other thread) did was to go back and rebuild the application, which (at least in my case) only uses standard, current, controls, and determine that the controls in the rebuilt application also showed the strange behavior.
This is not a "the application I created in 2005 doesn't run unchanged under Windows 10" issue.
Last Visit: 31-Dec-99 18:00 Last Update: 30-Apr-17 21:52