|
Hi!
I want to create few pannels(or any other object) that can be resized during run time.
Where can I see example of how to so.
I want that the mouse image will change to like in the design options in the .NET.
and so I will be able to controll few pannels(objects) in a form and to arrange them like I want .
Can some one show me a good example of this or code example.
Thanks
|
|
|
|
|
All you need to do is handle MouseDown, MouseUp, MouseMove and Paint events. Use Cursor property to change the cursor the way you like.
A bit of Googling will definitely give you some examples.
जय हिंद
|
|
|
|
|
Hello.
I have a application with a webclient. In that webclient I am loading a homepage with about 5 frames, but one of the frames are refreshing constantly each 30second.
That gives me problem when I want to use the source from another frame - because when I use IsBusy and it is refreshing the frame with constantly refreshing while I am navigating another frame, does the application think that frame is done navigating too, and then I of course get an error.
It happens very often, and stops the whole program.
So is there any way only to check one frame if it is done loading ?
Hope your guys can help me out.
|
|
|
|
|
Hello,
I have a button that opens a new form.
I want to check if the new form (form2) is already open then it will open another new form (form3). But if those 2 forms already open it will write a message. How can i do it?
|
|
|
|
|
FindWindow is a function For Finding Window.
If you can think then I Can.
|
|
|
|
|
public static Form IsFormAlreadyOpen(Type FormType)
{
foreach (Form OpenForm in Application.OpenForms)
{
if (OpenForm.GetType() == FormType)
return OpenForm;
}
return null;
}
Form2 UForm = null;
Form3 YForm = null;
On Form2 Show click event
if ((UForm = IsFormAlreadyOpen(typeof(Form2)) == null)
{
UForm = new Form2();
UForm.Show();
}
else
{
UForm.Select();
}
On Form3 Show click event
if ((YForm = IsFormAlreadyOpen(typeof(Form3)) == null)
{
YForm = new Form3();
YForm.Show();
}
else
{
MessageBox.Show("Forms are open");
}
Thanks,
A.m.a.L
|
|
|
|
|
Didn't you asked same thing few threads down?
जय हिंद
|
|
|
|
|
Hi All,
I have a class Class1. In Class1 constructor I am calling InitializeComponent().Which will be used to add controls to form at runtime. I have one more method Initialize(). In this Initialize() I am filling the value for the combo box.
My problem is the value is not updated in combo box.
Could any one help me to solve this issue.
Code snippet:
<pre>
Public Class1()
{
InitializeComponent();
}
Public void Intialize()
{
string[] employees = new string[]{"Hamilton, David", "Hensien, Kari"};
SampleComboBox.Items.AddRange(employee);
SampleComboBox.SelectedItem=employee[0];
SampleComboBox.SelectedIndexChanged += new System.EventHandler(this.SampleComboBox_SelectedIndexChanged);
}
This code is present in Designer.cs
Private InitializeComponent()
{
this.SampleComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.SampleComboBox.DropDownWidth = 97;
this.SampleComboBox.FormattingEnabled = true;
this.SampleComboBox.Location = new System.Drawing.Point(84, 16);
this.SampleComboBox.Name = "SampleComboBox";
this.SampleComboBox.Size = new System.Drawing.Size(91, 21);
this.SampleComboBox.TabIndex = 2;
this.Controls.Add(this.SampleComboBox);
this.Name = "SampleApp";
this.Size = new System.Drawing.Size(190, 51);
this.ResumeLayout(false);
}
private System.Windows.Forms.ComboBox SampleComboBox;
</pre>
Thanks,
Anandi
|
|
|
|
|
You need to call the Initialize method after InitializeComponent
Public Class1()
{
InitializeComponent();
Initialize();
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
how to validate the function on the front end in c# throe coding its important and urgent
|
|
|
|
|
aadikadain wrote: its important and urgent
Not for me.
जय हिंद
|
|
|
|
|
Don't get your question.
Generally you can validate a textbox as
if(String.IsNullOrEmpty(textBox1.Text))
MessageBox.Show("TextBox is empty");
You can also use the Validate event.
Another option is ErrorProvider.
Thanks,
A.m.a.L
|
|
|
|
|
Thank you Amal for posting that code snip. It helped me solve a little problem that I have had with validating textboxes.
|
|
|
|
|
Hi,
In my website I hv written JavaScript in which i want to assign one variable's value to session .
Please, give me solution .
Thank you.
|
|
|
|
|
|
Hi,
I hv written that JavaScript in c#.net code behind page.By using this.RegisterStartupScript .
Can u plz give me solution 4 this?
thank u.
|
|
|
|
|
There is an ASP.Net forum too.
I dont think this can be done as Session is a server side variable and script executes at client. Not sure though.
जय हिंद
|
|
|
|
|
Hi All,
I want to create the context menu at run time based on the value picked from DB,Please help me...
Regards,
Lalit Narayan
|
|
|
|
|
Use ContextMenu class.
जय हिंद
|
|
|
|
|
Hello ,
Can anyone help me...?
I want to know As Applications (Ms Word, Excel, Photoshop,..etc) can open files in two ways:
either using OpenFileDialg-like dialog,
or by opening them when user in a file manager double clicks a file (that the application knows how to open - MsWord opens files with "doc" extensions, Photoshop opens "psd",... etc).
I have created an application using c# .Net (Windows Application).
I want MY APPLICATION to be able to open file in this way: that is without using [open file dialog].
I managed to "associate" particular file extension (let it be "abc") to be opened by my application,
when the file (with "abc" extension) is clicked the program starts - but I dont know how to get the full path to the file in order to open it.
So, currently the program is executed upon double-click - but the program does not open the file clicked.
I know how to open the file, but I must know which file to open. This is the problem.
I would expect also an event that would be fired if the program would be already running, and a file (with "abc" extension would be clicked in windows explorer
(or any other file manager)) .
Thanx n Regds
Kapil
|
|
|
|
|
You have to parse the command line arguments. For WinForms it is in Program.cs file. Initially your main function must be something like that:
static void Main()
{
Application.EnableVisualStyles();
Application.EnableRTLMirroring();
Application.Run(new Form1());
}
You have to change this method, to parse the command line arguments, because when you double click a file that is associated with your program windows basically sends the file name as an argument. For example:
myapp.exe C:\myfile.txt
Your main function must be changed to something like that:
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.EnableRTLMirroring();
if(args.length > 0)
{
Form1 frm = new Form1();
System.IO.StreamReader myFile = new System.IO.StreamReader(args[0]);
string line = "";
line = myFile.ReadToEnd();
frm.textBox1.Text = line;
myFile.Close();
Application.Run(frm);
}
else
Application.Run(new Form1());
}
The above code is just an example which reads a text file or one with an extension that you want to use into textBox1.
I hope this example helps you to solve your problem.
Nuri
|
|
|
|
|
Thank you very much Nuri.....
It really worked.
Thank you very very much...
|
|
|
|
|
How to blink label in C#.Please let me know the solution
thanks in advance
|
|
|
|
|
Use Timer with small time duration. Toggle the visibility of the label in the Tick event.
जय हिंद
|
|
|
|
|
d@nish wrote: Use Timer with small time duration. Toggle the visibility of the label in the Tick event.
...but don't do it unless it is realy important because you will annoy the heck out of your users.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|