|
I really appreciate the code you gave me, but I don't entirely understand what's happening in there so I don't know how to make any modifications to the code. What I want to do is to make the parts end a little earlier, so that they don't meet in the middle. At the moment this is what's happening.
Thanks in advance!
- Martin
-- modified at 12:18 Tuesday 6th June, 2006
|
|
|
|
|
Hello,
I have a form which opens a second, new form and stays active in the background.
In the second form I want to pass a value to the open, active form by clicking on a button.
How can I do this?
TNX!
|
|
|
|
|
The easiest way to do what you want is to pass your FIRST form into the SECOND form. You can do this through the second Form's constructor when you create it in Form1.
Form2 myForm2 = new Form2(myForm1);
Or you can create an accessor on Form2:
myForm2.form1 = myForm1;
Once Form2 knows about Form1, you will then call your special method in Form1 when the user clicks on the button.
Another option is to create a delegate on Form1 which gets called when the button is pressed. Rather than passing in the entire Form1 or setting the Form1 accessor, you will set the delegate to use. Design-wise, this may be the better approach, but a few extra minutes to implement.
|
|
|
|
|
I don't really understand your explanation (what to do?).
But I was thinking, it isn't really necessary to pass a value ..
It's enough, that i close the second form by pressing a button, but i have to recognize that event in the first form, so I can react on that event.
So: Can somebody give me some example code to react when a form (which is created in an active form) is closed?
TNX!
|
|
|
|
|
Create a win app project
with two Froms : Form1 and Form2
In the Main() have Form1 as a parameter in Application.Run() method, like so
static void Main(string[] args) {
Application.Run(new Form1());
}
In The Second Form
Add a Button and a TextBox control.
Add public property that will be accessed from Form1 to retrieve a value assigned in Form2. I used string but of course you can use whatever type you need.
public string FormVariable {
get {
return Int32.Parse(this.txtIntValue.Text);
}
}
Code button click event
private void button1_Click(object sender, System.EventArgs e) {
this.DialogResult = DialogResult.OK;
}
In The First Form
Add a Button and code its click event.
private void button1_Click(object sender, System.EventArgs e) {
using (Form2 frm2 = new Form2()) {
System.Windows.Forms.DialogResult dr = frm2.ShowDialog(this);
string result = frm2.FormVariable;
MessageBox.Show("Form2 variable value: " + result,
"Message Called from Form1");
}
}
Run The App
Form1 will get displayed, click on its button.
Form2 will get displayed.
In Form2 type a value in the TextBox and click on the button.
Form2 will close and you'll see a message box showing you the value you typed in Form2.
This is obviously one of the possible solutions...
Let me know if it helps or if you have any queries.
Alex B. Clarke
-- modified at 14:04 Sunday 28th May, 2006
|
|
|
|
|
TNX!
That helped me out
|
|
|
|
|
Thanks for letting me know.
Alex B. Clarke
|
|
|
|
|
Good. Glad someone else answered properly. I was under the impression you were trying to accomplish something else. I thought you wanted Form2 to remain open and clicking on the button in Form2 changed some values or output in Form1.
|
|
|
|
|
Hi,
How to perform delete with datagridview.Please provide me code for this delete operation.
Thanks in advance.
|
|
|
|
|
You have to delete the datarow from the underlying datasource. The gridview will update itself to the new situation.
DataTable.Rows[index].Delete();
Simple as that
WM.
What about weapons of mass-construction?
|
|
|
|
|
<br />
datagridview.Rows.Clear();<br />
|
|
|
|
|
My code:
New line:
TLNode tln1 = new TLNode(1, treeList1.Nodes, new_item.Name_Link.Text, new_item.Link.Text);
treeList1.Nodes.Add(tln1);
This is new folder:
TLNode tln1 = new TLNode(1, treeList1.Nodes, new_folder.textEdit_New_Folder.Text, "");
tln1.HasChildren = true;
TLNode tln_children = new TLNode(2, tln1.Nodes, "", "");
tln1.Nodes.Add(tln_children);
treeList1.Nodes.Add(tln1);
If TreeList hot have folder - Ok! (new node can have focus)
If TreeList have folder and it is close - Ok! (new node can have focus)
If TreeList have open folder - new line in TreeList not can have focus.
Help me please!
|
|
|
|
|
Try to select the node: (for example you want to highlicht tln_children)
this.treeList1.SelectedNode = tln_children;
|
|
|
|
|
TreeList not have SelectedNode, it have FocusedNode.
But this dont help me.
If 1 folder is open in treelist:
node-
-node-
|node-
node-
I add node:
node-
-node-
|node-
node-
node(not focus, by FocusedNode)
I add node:
node-
-node-
|node-
node-
node(focus may be)
node(focus Ok, by FocusedNode)
I add node:
node-
-node-
|node-
node-
node(focus may be)
node(focus may be)
node(not focus, by FocusedNode)
...
I add node:
node(focus Ok, by FocusedNode)
I add node:
node(not focus, by FocusedNode)
...
May be you help me? I don't know how to fix this problem.
My code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Reflection;
using DevExpress.XtraTreeList;
using DevExpress.XtraTreeList.Nodes;
namespace video
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
TLNode tln1 = new TLNode(1, treeList1.Nodes, "dfhdfhgdf", "234523");
treeList1.Nodes.Add(tln1);
treeList1.FocusedNode = tln1;
}
private void simpleButton2_Click(object sender, EventArgs e)
{
TLNode tln1 = new TLNode(1, treeList1.Nodes, "4567rtyu4567", "ertye3456ertye");
tln1.HasChildren = true;
TLNode tln_children = new TLNode(2, tln1.Nodes, "trtr3636yryr", "6868cncn2525");
tln1.Nodes.Add(tln_children);
treeList1.Nodes.Add(tln1);
}
}
public class TLNode: TreeListNode
{
string name;
string url;
public TLNode(int id, TreeListNodes owner, string name_, string url_) : base(id, owner)
{
name = name_;
url = url_;
}
public override void SetValue(object columnID, object val)
{
}
public override object GetValue(object columnID)
{
return "text";
}
}
}
-- modified at 6:50 Monday 29th May, 2006
|
|
|
|
|
I'm using the System.Diagnostics.Process class to launch processes. I would like to trigger an event when a process exit. Do I have to use the Process.Exited event. How do i use it?
|
|
|
|
|
Mridang Agarwal wrote: Do I have to use the Process.Exited event.
Yes, unless you want to use the WaitForExit method.
Mridang Agarwal wrote: How do i use it?
Set the EnableRasingEvents property to true, and prescribe to the event as usual.
---
b { font-weight: normal; }
|
|
|
|
|
process.EnableRaisingEvents = true;
process.Exited += new EventHandler(process_Exited);
|
|
|
|
|
i can not found textbox for get password.plz help me.
|
|
|
|
|
I think this is the code, what will help u.
<asp:textbox id="txtPassword" Runat="server" MaxLength="15" Width="120px" TextMode="Password"></asp:textbox>
Thank you
BILLAH
|
|
|
|
|
thanks for ur help. i get my solution from ur message.
|
|
|
|
|
How to send sms from internet ?????
Please help me
-- modified at 17:12 Tuesday 30th May, 2006
|
|
|
|
|
How to send sms from internet ?????
Please help me
|
|
|
|
|
Hi,
I've been seeing of lot of Lua everywhere lately and i was planning to use it in one of my C# projects. i found this:
Lua interface[^]
basically what my application does is scrpae some information off a webpage. Since the website pattern could change anytime, i decided to use Lua for do the screen scraping. What would be better -
have my C# application get the source of the wepage and pass it to the Lua interface for data extraction and then have Lua return the extrcated data to my program
--or--
Make Lua, get the source of the webpage itself, extract the data itself, and then pass the data to the C# Program
I'm really confused (like I always am ). Could someone help me out here?
|
|
|
|
|
That depends on the reason why you want to use Lua for this. If it's good for requesting web pages, use it for that, otherwise not.
---
b { font-weight: normal; }
|
|
|
|
|
Well, after all I've read on the Internet my heads ringing with one thing. Thye all say Lua is excellent for small scripting, stuff like AI, data extraction etc. I came across this sotware called FreePOPs[^]. It basically lets you use your email client with email sites such as Yahoo and Hotmail which natively dont support POP access. They use Lua as the Screen Scraping code. When the design of the emil site changes, the software doent work and you can just download a fresh working version of the screen scraping script. Now, would this help you to reach a decision.
|
|
|
|