|
well in MAIN FORM's load method i am showing a dialogue box which asks for user name and password if the user provides incorent login then some buttons on the main form are Disabled..
But thats not the issue.. as i mentioned when i recompiled it on client machine the issue was resolved..
yesterday i saw some utitlites on code project the compile the code on the fly... I was thinking if it's possible to make application recompile on the client machine by using some sort of single calle function..
Q@!$3r
|
|
|
|
|
Rizawn wrote: compile the code on the fly
well, good idea.. could you kindly provide me the link for the same
Thanks in advance !!!!
|
|
|
|
|
|
|
There are probably two factors at work here...
1. If this is the first .NET application that has been run since the computer was last rebooted (or the first one run in a while), the .NET runtime itself (the CLR) needs to be loaded in to memory. This happens when your application first starts and does increase the startup time.
2. The fact that you can recompile on the client machine, which resolves the problem is probably due to my point above combined with the fact that the runtime no longer has to "fix up" as many assembly pointers in memory.
If the startup time really that large of a problem you should probably do some performance analysis and see where the application is spending most of its time during startup, and then fix those areas. .NET is already a dynamically (just-in-time) compiled language, so doing more dynamic compilation isn't going to help performance.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines][ Articles][ Blog]
|
|
|
|
|
Can someone please tell me how to check to see if a number has been entered by a user in form field?
|
|
|
|
|
Surely you can try look for the answer yourself...
|
|
|
|
|
Hello leppie,
I have attempted to look, but was not able to find an answer (hince the reason I have posted to the board). I thank you for your "non-willingness" to help though. Have a nice day.
|
|
|
|
|
when do you want to validate that?
if you want to validate on textchange you can write code for that . or for any button click you can use Regx.
Thanks
|
|
|
|
|
Thank you. I will give it a shot.
|
|
|
|
|
That work. Once again thank you.
|
|
|
|
|
you are welcome
|
|
|
|
|
int number;
bool isNumber = int.TryParse(text, out number);
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi Greeeg,
Great Idea !!!!
|
|
|
|
|
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsApplication11 {
public class FormA : Form {
public virtual new Size PreferredSize {
get {
return new Size(300, 300);
}
}
}
static class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form form = new FormA();
form.Size = form.PreferredSize;
Application.Run(form);
}
}
}
Chris
|
|
|
|
|
chris175 wrote: public virtual new Size PreferredSize { get { return new Size(300, 300); } }
What is "Size" ?
|
|
|
|
|
|
Its Working Fine
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsApplication11
{
public class FormA : Form
{
public virtual new Size PreferredSize
{
get
{
return new Size(300, 300);
}
}
}
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form form = new FormA();
Application.Run(form);
form.Size = form.PreferredSize;
}
}
}
|
|
|
|
|
I encountered something similar, and got the right size AFTER the call to Application.Run (). If you get the size in FormA's Load method, it might be right at that point.
|
|
|
|
|
Because when you Application.Run(form) , InitializeComponent() gets called which probably resets the size of the form.
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
The wrong size is placed on the form BEFORE Application.Run(form) is called. I dont think it has anything to do with InitializeComponent() function since there isn't one within the class FormA .
Chris
|
|
|
|
|
carbon_golem wrote: Because when you Application.Run(form), InitializeComponent()
No, you have it all wrong, there is no magic involved. InitializeComponent() is usually called from the Form's constructor.
|
|
|
|
|
If you do FormA form = new FormA() then your method will be called, otherwise the System.Windows.Forms.Control.PreferredSize property will be called (can be seen in .NET reflector). I guess this has to do with the fact that PrefferedSize in Control is not marked virtual or abstract .
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
PreferredSize isn't virtual; you cannot override it.
Instead your code created a new virtual property with the same name - but your Main method refers to the original PreferredSize property.
You should override the virtual GetPreferredSize method instead.
|
|
|
|
|
That is what I was looking for... Thanks
|
|
|
|