|
assuming that all your forms have been declared in a namespace called "WindowsApplication" you could do something like this:
In the click event handler of the button:
((Form)System.Reflection.Assembly.GetExecutingAssembly().CreateInstance("WindowsApplication." + textBox1.Text + "Form")).ShowDialog();
In the TextChanged event handler of the textbox:
button1.enabled =
textBox1.Text == "Blackcomb" || textBox1.Text == "XP" || textBox1.Text == "Chicago";
|
|
|
|
|
I think a nice solution could be done using a bit of Reflection...
<br />
<br />
string inputFormName = this.textBox1.Text;<br />
string CurrentFormAssemblyQualifiedName = this.GetType().AssemblyQualifiedName;<br />
<br />
string TargetFormAssemblyQualifiedName = CurrentFormAssemblyQualifiedName.Replace ( this.Name, inputFormName );<br />
<br />
System.Type formType = System.Type.GetType ( TargetFormAssemblyQualifiedName );<br />
<br />
if ( formType != null )<br />
{<br />
System.Windows.Forms.Form frm = ( System.Windows.Forms.Form )Activator.CreateInstance ( formType );<br />
frm.Show (); <br />
}<br />
<br />
This Example is working in my PC, because I have tested... It is based in the fact that both forms are in the Same project and folder ( means Exactly Namespace, and the TextBox has exactly the name of the Form... so you'll have to play a bit with it... )
Good Luck
Ricardo Casquete
|
|
|
|
|
Hi,
I am working on a website, in which i need to call a stored procedure to
update some fields of the database at regular intervals, say after every 30 days.
I am using Timers to call the stored procedure after the specified interval.
But i am in a fix as to where to place this code, so that it automatically gets executed on the server.
Or is there any other procedure i can follow to accomplish this task?
Thanks
|
|
|
|
|
if you're using SQL Server, why not just set it up on the server as a recurring job that runs every 30 days? 30 days is a LONG time to wait for an app to run for testing purposes. And even though you could probably simulate it another way, it's still not the same as waiting for it to actually run unattended.
My Music | My Pics | My Articles
BlackDice
|
|
|
|
|
I tried to use job scheduling, but noticed that the time period needs to be set, whereas, in my website, i might need to change the time interval... its could change to 40days or any other time interval.
The main purpose is to implement caching.
The records in the database would expire after a certain time interval and new records would be inserted.
I need to execute a stored procedure that would update the database and set the records as expired after the specified time interval.
Is there any possiblity to set the time period through my C# code?
Is there any other alternative to timers ?
|
|
|
|
|
Hi All,
I need a bit of help with algorithms. What I need is a method which takes a string as an argument and returns an array containing every permutation of the letters making up the string.
For example, with the input of Dog, I'd expect to see back:
dog
god
gdo
dgo
... etc in the array.
If anyone can help with this, it'd be much appreciated - especially if you can explain how it does it!
TIA
Utini.
Hey, Sweden!
They're not Swedish Mac, they're Norwegian.
|
|
|
|
|
Search for permutations and combinations, I am sure there are at least one example on CP
|
|
|
|
|
I have done this in the past for a Scrabble solver. You can uncomment the line; //retval.Add(current); if you want to see all possible sequences for a scrabble type solution (i.e. solutions that don't use all of the letters). If your word contains duplicate letters, you will have to sort the returned array and take out the duplicate string results.
private List<string> GetAllSequences(string str)
{
List<string> retval = new List<string>();
if (str.Length > 0)
{
if (str.Length == 1)
{
retval.Add(str);
}
else
{
string current;
string theRest;
for (int i = 0; i < str.Length; i++)
{
current = str.Substring(i, 1);
theRest = str.Remove(i, 1);
foreach (string appender in GetAllSequences(theRest))
{
retval.Add(current + appender);
}
}
}
}
return retval;
}
|
|
|
|
|
Is it opssible to use a flash object in a form so when you load the form, it shows the flash object? you knwo a Macromedia Flash object. Is it possible?
In the end we're all just the same
|
|
|
|
|
Hi, DataGrid/WinForm -
a. how do I set column width?
b. how do I set column width to "AutoFit"?
Thanks
|
|
|
|
|
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx
|
|
|
|
|
Hi!
First, many thanks for the good answers one usually receives on this forum!
Now, I would like some hints how I can control the painting of a UserControl. Let's say I have a bunch of buttons and some labels in this control. Then, at some time, I update the label contents and the button colors. But when the actual painting is performed it is not done synchronized, i.e., the buttons (in my case) is drawn slightly before the labels. I don't like the look of that! I would prefer showing the redrawn control AFTER all of its child controls have been redrawn. Is this possible?
Thanks.
Magnus
|
|
|
|
|
What is the community recommendation for a serious .NET C# (2003 pref) profiler? I see Nprof, ANTS, Microsoft, Sementics... more?
|
|
|
|
|
|
Hi
I'm having a C# Windows Appplication with Crystal Reports. Each Reports has about 15-15 sub-reports. When I tried to change one of the sub-report, the other sub-reports are getting modified. All the reports are created in Crystal Report 10 and are bind to SQL SERVER by stored procedures.
Can anyone help me...
Warm Regards
Abhijeet Ballal
|
|
|
|
|
my experience in Crystal Reports is to use as little sub reports as possible.
What do you mean by the other sub-reports are getting modified ?
is the data shown, different? Are the different sub-reports the same subreport, but with a different parameter passed to it?
Coulda, woulda, shoulda doesn't matter if you don't.
|
|
|
|
|
Thanks for quick reply..
Exactly.I've modified say Sub-Report 1, I've added one Formula for one field to check for NULL Values. I save the report when I run my App. It's removing some Pie-Charts from say Sub-Report 2.
Yes these are the sub-reports of same reports they are bind to different parameterised Procedures.
Does it because of Version Conflicts?
Warm Regards
Abhijeet ballal
|
|
|
|
|
All the subreports that come from the same subreport will be modified if you make a change. You need to create a different subreport if you don't want that to happen.
good luck.
Coulda, woulda, shoulda doesn't matter if you don't.
|
|
|
|
|
string zipFileName=@"d:\sample.txt";
System.IO.FileInfo file = new System.IO.FileInfo(zipFileName);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
Response.Write("Downloaded successfully");
The above code is working pretty good for file download but i want to execute the last statement.How to display that message.
SreekanthJ
-- modified at 6:32 Monday 27th March, 2006
|
|
|
|
|
That is not possible.
As the response you are sending to the browser is the file, there is no page to display the message on.
If you wan't to display the status in the browser, you have to store the status on the server, and have a different page polling the status.
---
b { font-weight: normal; }
|
|
|
|
|
Hi.
I was wondering if someone could give me some pointers. Many are familiar with the GUI in Outlook. For instance on the lower left corner you can click Mail or Calendar and then you get an appropiate window on the right. How is this done? Also, the main window is split into three parts, how is that done?
I am not asking for details although they will be appreciated, a useful pointer would be very nice. What classes can one use?
Thanks a bunch,
FJ
|
|
|
|
|
naglbitur wrote: For instance on the lower left corner you can click Mail or Calendar and then you get an appropiate window on the right. How is this done?
Which Outlook version are you talking about. I use Outlook 2000 and have nothing of that sort.
naglbitur wrote: Also, the main window is split into three parts, how is that done?
Outlook 2000 is divided into 2 parts. My guess is that it is a Splitter control. Check this[^] for reference.
Hope this helps...
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
Hi, thanks for your answer.
I am talking about Outlook 2003, that´s the only program I remember at the moment that has this feature I am refering to so I am afraid I can´t point to any other programs to better explain what I mean. It is similar to TabControl and TabPage.
I am sure you are right about the splitter control, I´ll take a look at it later, thanks for the tip.
Thanks again,
FJ
|
|
|
|
|
Hi!
Simple question:
How do I change the color of the caption of a GroupBox control in .NET 2005? The ForeColor member changes only the color of the controls INSIDE the groupbox. How hard can it be..?
Thanks.
/Magnus
|
|
|
|
|
Hi!
I'd expect the ForeColor of the control containing the GroupBox to be the one shown in the GroupBox caption. Have you tried this yet?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|