|
Hi
I have problem in loading form back and forth. In form1 if i click next button I am showing form2 and hiding the form one. But when i click the cancel button in the form2 it will ask do you wan to exit with ok and cancel button if i click ok it is exiting the current application. if i click cancel the application is still running but i could able to see any form. any one help me please.
form1 code:
```````````
btnnext_click(object sender,eventargs e)
{
form2 objform2=new form2(this);
objform2.ShowDialog();
}
btncancel_click(object sender,eventargs e)
{
if(messagebox.show("Do you want to exit","Exiting", messageboxokcancel,messageboxquestion).equals(dialogresult.ok)
system.window.form.exit();
}
form2 code:
```````````
private Form frmForm1;
public form2(Form objForm)
{
frmForm1=objForm;
}
btnnext_click(object sender,eventargs e)
{
form3 objform3=new form3(this);
objform2.ShowDialog();
}
btncancel_click(object sender,eventargs e)
{
if(messagebox.show("Do you want to exit","Exiting", messageboxokcancel,messageboxquestion).equals(dialogresult.ok)
system.window.form.exit();
}
btnback_click(object sender, eventargs e)
{
frmForm1.visible=true;
}
form2_load()
{
------ some code
------ some code
frmForm1.visible=false;
}
sorry i missed the load event. Any one help me please
kesavan
|
|
|
|
|
i'm not quite sure what exactly is you problem, is it not being to close the application or not being able to show the forms.
but i did have a look at your code. the code below is in c# (which is similar to your code) and worked fine for me.
form1:
------
<br />
private void btncancel_Click(object sender, System.EventArgs e)<br />
{<br />
if(MessageBox.Show("Do you want to exit","Exiting",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)<br />
Application.Exit();<br />
}<br />
<br />
private void btnnext_Click(object sender, System.EventArgs e)<br />
{<br />
Form2 objform2=new Form2(this);<br />
objform2.ShowDialog();<br />
}
form2:
------
<br />
private Form1 frmForm1;<br />
public Form2(Form1 objForm)<br />
{<br />
frmForm1=objForm;<br />
}<br />
private void btncancel_Click(object sender, System.EventArgs e)<br />
{<br />
if(MessageBox.Show("Do you want to exit","Exiting", MessageBoxButtons.OKCancel,MessageBoxIcon.Question) ==DialogResult.OK)<br />
Application.Exit();<br />
}<br />
<br />
private void butback_Click(object sender, System.EventArgs e)<br />
{<br />
frmForm1.Visible=true;<br />
this.Close();<br />
}<br />
<br />
private void Form2_Load(object sender, System.EventArgs e)<br />
{<br />
frmForm1.Visible=false;<br />
}<br />
|
|
|
|
|
Hi
What is my problem is if i click btcancel_clcik it will ask do you want to exit right?. In that message box(ok button and cancel button) if i click cancel i cant able to see any form.
kesavan
|
|
|
|
|
Hi
I solved the problem by changing showdialog to show.
i mean form1.showdialog() to form1.show()
Anyway thanks for spending your time for me
kesavan
|
|
|
|
|
Hi Friends
I would like to retrieve all the users from a particular Active Directory group. Can anyone tell me how to do this. I tried but i got this error:
There is no such object on the server
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: There is no such object on the server
This is my coding:
DirectoryEntry deGroup = new DirectoryEntry ("LDAP://cn=groupName,dc=itech,dc=com");
foreach(object oMember in deGroup.Properties["member"])
{
Response.Write(oMember.ToString());
}
|
|
|
|
|
hi!
whenever an click event of any control occurs in my C# asp.net web application(visual studio.net 2003), form load is called again and all controls are initialized. Like i m using check box in my grid and want to capture my check state against any button click. But when i click button then form is again loaded and all check boxex became converted in their default state(which is unchecked).
therefore the following condition in my button click event alwayx bacame false coz at that time no check box is in checked state.
the condition is
if(checkbox.checked)
i have many other problems also due to this from loading against any event. Therefore can u tell me how to stop this loading every time.
|
|
|
|
|
Hi,
Are you controlling if the PageLoad is from a postback (IsPostBack porperty)?
|
|
|
|
|
Check whether viewstate is disabled at any level.
Control/Page/Web.Config
|
|
|
|
|
Hi,
I have a C# appln, which contains a explorer style Tree view. Whenever any folder or file is created in the Windows Explorer externally, my application Tree view has to update. Is there any windows file system refresh event or message is there to call my method to update Treeview.
I hope you understand what I mean.
Thanks in advance...
Best Regards,
Sunil Jampa.
|
|
|
|
|
|
Hello,
// Create a new FileSystemWatcher and set its properties.
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = args[1];
/* Watch for changes in LastAccess and LastWrite times, and
the renaming of files or directories. */
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
| NotifyFilters.FileName | NotifyFilters.DirectoryName;
// Only watch text files.
watcher.Filter = "*.txt";
// Add event handlers.
watcher.Changed += new FileSystemEventHandler(OnChanged);
watcher.Created += new FileSystemEventHandler(OnChanged);
watcher.Deleted += new FileSystemEventHandler(OnChanged);
watcher.Renamed += new RenamedEventHandler(OnRenamed);
// Begin watching.
watcher.EnableRaisingEvents = true
Regards ,
nishu
|
|
|
|
|
Hi Nishu,
Thanks for the reply!
Actually, whenever any file or folder is created/deleted in any drive irrespective of path in the Windows explorer, my method has to update for that event.
Here Path you mentioned is particular to a specified directory, if i am right. But external changes to the Windows explorer, I dont know which file/folder in which directory, it was changed.
How can I update my Tree view, if any Windows Explorer File System refreshes. I need a standard File System Refresh done by windows explorer.
Thanks again in advance...
Best Regards,
Sunil Jampa.
|
|
|
|
|
Hello,
This is the only way I can think of right now ,but I think you should select path as a root path for each drive that will take care of all the events unde.Have you try that.??
Regards ,
nishu
|
|
|
|
|
hi,
i am creating a editor in RichTextBox.
I want to create a pop-up menu when user clicks the Mouse Right button for copy,cut,paste.
can any one help me
Thank you
Prasad
|
|
|
|
|
Hello,
Use contexMenu from form controls.
Regards ,
nishu
|
|
|
|
|
hi,Nishu
wheather it is control in c#.
may i know the syntax pls
With Regards
Prasad
|
|
|
|
|
Hello,
Ya dear just drag and drop from form controls.
ContextMenuStrip
or create new
ContextMenuStrip cmenu = new ContextMenuStrip();
Regards ,
nishu
|
|
|
|
|
hi,Nishu..
I created a object of context menu
then how to add edit main menu to that one?
Thank You
Prasad
|
|
|
|
|
hi,
whenever i compile a project i want a form to be in the same position,when it is loaded.
User should not be able to move the Form at run time.
I set the Locked property to True still it can be moved at runtime.
Pls help me
Thanks
Prasad
|
|
|
|
|
Lock property works only in designer.
If you want to set the location, then get the event "LocationChanged" from the form, and every time the form moved, then set the location back to default location.
For example :
private void Form1_LocationChanged(object sender, EventArgs e)
{
this.Location = new Point(10, 10);
}
|
|
|
|
|
hi,
Thank you it is working
With Regards
Prasad
|
|
|
|
|
If you reset the location in the locationchanged event then you can see the form is moving to new position and then resetting to old position. But ideally form should not move at all at first instance. This could be obtained by trapping the windows message for form move. Try following code and it will not allow the form to move at first instance. However pls test the things after adding this piece of code..
protected override void WndProc(ref Message m)
{
const int WM_NCLBUTTONDOWN = 161;
const int WM_SYSCOMMAND = 274;
const int HTCAPTION = 2;
const int SC_MOVE = 61456;
if((m.Msg == WM_SYSCOMMAND) && (m.WParam.ToInt32() == SC_MOVE))
{
return;
}
if((m.Msg == WM_NCLBUTTONDOWN) && (m.WParam.ToInt32() == HTCAPTION))
{
return;
}
base.WndProc (ref m);
}
|
|
|
|
|
hi,
may i know what are these code and which event should i add these code
what m indicates
pls.
With Regards
Prasad
|
|
|
|
|
C#
Visual studio 2003
Os: XP
I have put 3 gif file in a ImageList.I want to place the
picture from ImageList and put over the picturebox.
I can place the picture and display
the picture is ok.But In the ImageList all are Animated
file that file is not animated in the picture box.the probelm
is only taking the picture from the ImageList.Anybody help me.
I hope to get soon.
MaxWorld Technology Pvt
|
|
|
|
|
Hi,
Is not the better solution, but try to put the images in a label control.
|
|
|
|