|
1) FormClosing event occures before FormClosed event.
2) You create the Second Form in your First Form's closing event where GarbageColelctor destroyes the Second Form after the First Form is closed.
3) You should do:
Form1 F = new Form1();
Application.Run(F);
Hope this helps...
|
|
|
|
|
Hi
I am displaying the 3 labels controls in a group box. like this
Previous Current Next
ATE-1 ATE-1 ATE-1
if the form has been resized or if the text ATE-1 is changed their alignment changed accordingly.
How can i maintain the alignment between these label controls even if the user maximiz the form or if the text changes
|
|
|
|
|
Hi All
I've 2 Table , table1 id_main[int], Id_detail
table2 Id_detail[int] , goods[nvarchar] and there is a relation between table1.Id_detail and table2.Id_detail
now in the form :
i use a textbox for id_main and a combobox for goods to show it
i want to use a button to move between records for e.g. next ,
in form1_load i wrote :
...<br />
SqlDataReader drSQL;<br />
string strID;<br />
string strID;<br />
try<br />
{<br />
strSQL = "SELECT * FROM table1";<br />
SqlCommand cmd = new SqlCommand(strSQL,myconnection);<br />
myconnection.Open();<br />
drSQL = cmSQL.ExecuteReader();<br />
if (drSQL.Read())<br />
{<br />
txtIndex.Text = drSQL["id_main"].ToString();<br />
strID = drSQL["Id_detail"].ToString();<br />
FindItemByID(cbxGoods, strID)<br />
}<br />
...
in Next_click (...) event , How can navigate between record .
private void btNext_Click(object sender, EventArgs e)<br />
{<br />
??<br />
}
thanx a lot
s_mostafa_h
|
|
|
|
|
Use a BindingNavigator component, no need to reinvent the wheel
hope this helps...
|
|
|
|
|
Hello everyone,
I've done a bit of searching to see what I can find, but not much is appearing. What I'm looking to do is create a small application that will remember icon positions for me (on my desktop). Yes, there are a hundred of these apps out there, but I want to go about it differently than any of the apps I've used.
So, can anyone give me any ideas or pointers to where icon position is stored, and how I can access/change it?
Thanks in advance!
-Sean
|
|
|
|
|
 Hi,
this is a very complex matter, that involves many P/Invoke functions, and consists
of the following steps:
1. find the handle to the listview: in Windows XP the desktop is a listview; to get there,
you must descend the chain "Progman", "SHELLDLL_DefView", "SysListView32".
2. for each of the icons, send an LVM_GETITEMPOSITION or LVM_SETITEMPOSITION message.
Since the message goes to another process and requires a data pointer, that data pointer
must be valid in the other process, so you must first allocate memory in that process.
You will probably need the following prototypes:
[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern int OpenProcess(uint access, bool inheritHandle,
uint procID);
[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern bool CloseHandle(int handle);
[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern IntPtr VirtualAllocEx(int hProcess, int address,
int size, uint allocationType, uint protection);
[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern bool VirtualFreeEx(int hProcess, IntPtr address,
int size, uint freeType);
[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern bool WriteProcessMemory(int hProcess,
IntPtr otherAddress, IntPtr localAddress, int size,
ref uint bytesWritten);
[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern bool ReadProcessMemory(int hProcess,
IntPtr otherAddress, IntPtr localAddress, int size,
ref uint bytesRead);
[DllImport("kernel32.dll", CallingConvention=CallingConvention.StdCall)]
private static extern bool ReadProcessMemory(int hProcess,
IntPtr otherAddress, StringBuilder localAddress, int size,
ref uint bytesRead);
Then there will appear one major problem: moving an icon to a position that is occupied
makes Explorer reshuffle a lot of icons; so dont expect to easily get the layout you hope.
If you succeed, please let me know !
|
|
|
|
|
Heh, this is certainly going to be a tough one for me, but you've provided exactly what I needed, a good outline to get me started.
Thanks a bunch! I'll be sure to let you know if I succeed!
|
|
|
|
|
Right Click on the desktop, disable Auto Arrange under Arrange Icons by menu 
|
|
|
|
|
Hahah... yeah, I've never had auto-arrange on. No, I'm looking for something a bit more dynamic than that. I'm [hopefully] building a system that will let me classify my desktop icons (whether its a shortcut, folder, or file) and group them dynamically.
But, I have a lot to learn first, so that first reply was a perfect roadmap for me. 
|
|
|
|
|
My Form have a button.
When I click the button, a Toolbox is shown.
This Toolbox is always on top of My Form.
Do you know how to create ToolboxM
Thank You.
|
|
|
|
|
C#
XP
1. A Connect internet
2. B router Connect internet and C is machine
B ip address is 58.6.3.6
C have a IP address is 192.168.1.3
A is machine direct connect internet
and B is router is connected a system.
I can send the file B to A
I could not nend the file A to B.
How can make lestion in B router.
Any body help me
Continue...
|
|
|
|
|
So what does this have to do with C#?
BTW, your explanation needs work. You might want to try using mmore than 58 words to describe the setup of your equipment and the problem you're having.
It took me quite a bit of reading to figure out "1. A Connect internet" meant. Is this a Windows PC? Which version? What's installed on it to do this internet sharing? What is "B"? How's it onfigured? You mentioned machine "C", but you didn't say anything about having any problems with this, so why even mention it?
Don't respond to this in the C# Forum. Use the Hardware Forum instead.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I think he's having trouble traversing NAT (Network Address Translation).
Computer A is directly connected to the internet
Computer B is connected through an NAT router
He wants to send a file from A to B, but can't get through the router.
This is a pretty well-explored problem, but the quick solutions are:
1) Use a reverse-connect protocol. Instead of A connecting to B to send the file, have B connect to A and request the file. As long as B creates the connection, you're golden.
2) Specifically configure the router to forward the packets (This is only viable for an in-house solution, as you can't expect random users to do this), and figure out B's external IP by looking at the incoming connection on A, instead of having B tell A its IP.
I'm assuming you're trying to PROGRAM something like this... If you're having trouble doing this in an application, then this is the wrong forum.
|
|
|
|
|
Dave Kreskowiak wrote: So what does this have to do with C#?
Got me on that. I don't see anything to do with C# in the post
|
|
|
|
|
can someone give me a sample code on how I can execute a different application thru C#?
|
|
|
|
|
Try to explore Process.Start.
Plenty is available in Google.
Regards,
Arun Kumar.A
|
|
|
|
|
Look at Process.Start as mentioned by the other poster...
|
|
|
|
|
Have a look at MSDN Library for Process.Start(...)
Hope this helps...
|
|
|
|
|
Thanks guys, I was very busy this weekend and did not have a chance to look at it, I will look at it this afternoon.
|
|
|
|
|
Hello ,
I need your help on this, I have a C# 2005 application that includes Crystal reports, whenever I deploy this project I get an unhandle exception saying :"Could not load file or assembly Crystal decisions.Windows.Forms Version.... PublicKeyToken or one od dependencies, the system can't find the specific file" although I included the Crystal Reports on the prerequisites of the Setup file and I always included the assembly Crystal decisions.Windows.Forms to the application folder.
Thanks a lot
Nermeen
|
|
|
|
|
Did you add the merge modules to the setup kit? If not have a look at this[^]
|
|
|
|
|
Hi,
I have a webservice serving a dataset with several tables. Every table has two main webmethods that allows then to interact with the databound controls in the client.
The general form of these methods are (please, its just a sample code to give the idea of the process):
<br />
[WebMethod]<br />
public MyDataSet.MyTableDataTable MyTableGetAll() {<br />
MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter();<br />
return vTa.GetAll();<br />
}<br />
<br />
[WebMethod]<br />
public int MyTableUpdate(MyDataSet.MyTableDataTable pDt) {<br />
MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter();<br />
return vTa.Update(pDt);<br />
}<br />
They work just perfect and I can use any databound control as if the dataset was local.
But how can I add encryptation to this solution without losing the bahavior of the conection.
I know how to send encrypt data via RSA keys thru a webservice but only with basic datatypes (as string or itegers) and even encrypt a content of a XML message. But how can I encrypt the data and the metadata structure (cause it would be terrible to encypt the data and give up the table structure in the resulting XML) and retrieve the DataTable object funcionality at the client side and vice-versa?
The following solution works?
<br />
[WebMethod]<br />
public {XML or String} MyTableGetAll() {<br />
MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter();<br />
return SomeEncryptFunction(vTa.GetAll());<br />
}<br />
<br />
public localhost.MyDataSet.MyTableDataTable GetMyTableData() {<br />
localhost.WebService vSvc = new localhost.WebService();<br />
return SomeDecryptFunction(vSvc.MyTableGetAll());<br />
}<br />
<br />
...<br />
oDataBoundObject.DataSource = GetMyTableData();<br />
...<br />
If It does what would be the code for SomeEncryptFunction and SomeDecryptFunction (the second one is the most important 'cause it has to retreive the DataTable object properly) ?
Thanks in advance for any help about this.
Sir Gallahad
P.S.
I've been reading about implementint security and cryptograpy to web services with WSE SOAP headers. But the articles I've read does not explain well how to code in the client and server side to make the handshake between them.
If that is the solution, can someone help me explaining how to do that.
Please any clue. Any code. Any link. Please. 
|
|
|
|
|
hi,
the slution file of my project is not showing in the solution explorer. i can see the project and project file.
how can i see that?
My small attempt...
|
|
|
|
|
hi
Compile your project once, you will see .sln file under your folder. It will not appear in solution explorer. And wht do you want to do with .sln file??? 
|
|
|
|
|
Try FILE->SAVE ALL.
Sometimes it brings up a dialogue asking where you want to save the solution file...
The save it in your project's folder.
|
|
|
|