|
Hi, i try to help you.
If Form2 should do the same like Form1, you should try to create the Form2 in Form1.
So you have a reference to the Form2. You create form2 for example at the constructor of form1.
MyForm1::MyForm1(void)
{
OtherForm = new MyForm2; ( OtherForm should be a class member, to have all the time an access)
}
then you derive the ShowDialog() Method. there in you call naturally the base-method and then the ShowDialog of the Form2 "OtherForm.ShowDialog"
In this way you proceed with all methods you need.
If ShowDialog is protected/private for Form2, you need to derive also ShowDialog from Form2 but
as public.
I hope i could help you a little bit.
Good luck
|
|
|
|
|
hi,friend
i will clear it u
I am creating a editor and main from is made as an MDI parent and i want to implement a Find Functionality..
if i opened the Find form and Minimize the main from the find also should be minimized ..
i want something like pls refer..
open notepad Type somethingclick Find and minimize the notepad....
the same thing
With Regatds
prasad
|
|
|
|
|
1. Use Show(), not ShowDialog()
2. Use event SizeChanged in Form1.
private void Form1_SizeChanged(object sender, EventArgs e)
{
this.form2.WindowState = this.WindowState;
}
|
|
|
|
|
hi,friend
i will clear it u
I am creating a editor and main from is made as an MDI parent and i want to implement a Find Functionality..
if i opened the Find form and Minimize the main from the find also should be minimized ..
i want something like pls refer..
open notepad Type somethingclick Find and minimize the notepad....
the same thing
With Regatds
prasad
|
|
|
|
|
yepp,
i came to the same solution.
But there is still the problem, that the "FindWindow" disappears behind the MainForm, if the
MainForm gets the focus.
But i never made things like this in C# before
|
|
|
|
|
Hi everyone,
Can anyone please tell me how do you get only the file name out of openFileDialog1.FileName, cuz I keep getting the path along with the file name.
Many thanks
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
<br />
string fileName = Path.GetFileName(openFileDialog1.FileName);<br />
|
|
|
|
|
Path what's this??
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello,
Look at the System.IO namespace.
There you will find the path class, with a lot of fancy methods.
All the best,
Martin
|
|
|
|
|
Martin# wrote: ... a lot of fancy methods.
Thank you Martin, you're the fancy one
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
i hope this helps. this open file dialog is for xml files only. use the file extensions accordingly.
OpenFileDialog ofn = new OpenFileDialog();
ofn.Filter = "XML Files (*.xml)|*.xml";
ofn.Title = "Type File";
if (ofn.ShowDialog() == DialogResult.Ok)
{
}
then u can get the file name as
ofn.FileName
Keshav Kamat
India
|
|
|
|
|
Keshav V. Kamat wrote: i hope this helps
Sorry, but not at all I'm well familiar with the OpenFileDialog, my question was how to get only the file name and FileName property is giving me the full path.. thanks anyways buddy.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
hi all,
i am working in windows form, i couldn't reach to the destination file when in use(""..\\..\file name");
which method should i use to reach to a perticular dirctory of my machine,
i know in web i used to use server.mappath...but here i don't know,
bye byes
prashanth
|
|
|
|
|
if u want to know the application path of ur program then u can use
Application.StartupPath;
rahul
|
|
|
|
|
Hi
You can get using Application instead of Server. Try this
Application.StartupPath.ToString(); -> this will give the current application path.
There are some properties for the class Application like:
- ExecutablePath
- LocalUserAppDataPath
Hope this helps you.
Harini
|
|
|
|
|
Harini Krishnaswamy wrote: Application.StartupPath.ToString();
Application.StartupPath is already a string . Why do you put .ToString() on the end of it?
|
|
|
|
|
Hi Colin,
You are right. No need to give ToString(). Application.StartupPath is enough.
Harini
|
|
|
|
|
Hi
I am trying to develope an Utility to handle reporting of errors and exceptions in my application. Whenever an exception occurs I want the exception details to be written to a XML file.
I am using the following code, but it does not append to the file, it overwrites the previous data. How can I have the new exceptions append to the file so that I have a full history of all the exceptions without having to create a new file each time?
private static void LogException_XML(DateTime date, string fullpath, string localPath, Exception e)<br />
{<br />
try<br />
{<br />
XmlWriterSettings settings = new XmlWriterSettings();<br />
settings.Indent = true;<br />
settings.IndentChars = (" ");<br />
using (XmlWriter writer = XmlWriter.Create(fullpath, settings))<br />
{<br />
writer.WriteStartElement("Exception");<br />
writer.WriteElementString("Date", date.ToShortDateString());<br />
writer.WriteElementString("Time", date.ToShortTimeString());<br />
writer.WriteElementString("Message", e.Message);<br />
writer.WriteElementString("Source", e.Source);<br />
writer.WriteElementString("Stacktrace", e.StackTrace);<br />
writer.WriteElementString("TargetSite", e.TargetSite.ToString());<br />
writer.WriteElementString("TargetSite", e.TargetSite.ToString());<br />
writer.WriteEndElement();<br />
writer.Flush();<br />
}<br />
<br />
}<br />
catch (Exception ex)<br />
{<br />
throw ex;<br />
}<br />
}
Thanks.
Kobus
|
|
|
|
|
You could use an overload of the XmlWriter.Create method that takes a Stream instance instead of the filepath and explicitely create a FileStream that appends to the file, but this will create invalid XML since an XML document must have a single root element. I'm not sure how hard it is to position the XmlWriter in a way that you will overwrite the closing root element tag, so I recommend the XmlDocument class.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Dear all,
How would I be able to generate MS project File in C# ?
Lq
|
|
|
|
|
I've got a remoting based application up and running (basically a client app that uses a custom server to access a database, etc), and it seems to do everything fine as long as the client and server are on the same Windows domain.
Unfortunately it also needs to be used on another domain within the company (both domains can see each other, btw).
When the client application is run on the other network, I get the following exception:
=============================================================================
InvalidCredentialException: The server has rejected the client credentials.
Stack Trace:
Server Stack Trace:
at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential credential, String targetName, ProtectionLevel requiredProtectionLevel, TokenImpersonationLevel allowedImpersonationLevel)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateAuthenticatedStream(Stream netStream, String machinePortAndSid)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateSocketHandler(Socket socket, SocketCache socketCache, String machinePortAndSid)
at System.Runtime.Remoting.Channels.SocketCache.CreateSocketHandler(Socket socket, String machineAndPort)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITransportHeaders& responseHeaders, Stream& responseStream)
at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
...
=============================================================================
Where do I start in determining what's wrong with the setup, or is this just something I'll have to do differently if the app is going to straddle 2 domains?
-- modified at 1:00 Monday 26th March, 2007
|
|
|
|
|
Hi!
You could try using a http channel instead of a tcp channel...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I'll give that a go.
I thought I should add the client and server remoting configuration as well:
server:
<channel ref="tcp" port="6792" displayName="TCC Channel (MyServer)" authenticationMode="IdentifyCallers" secure="true" authorizedGroup="Users">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
client:
<channel ref="tcp" port="0" displayName="TCP Channel (MyClient)" authenticationMode="IdentifyCallers" secure="true" authorizedGroup="Users">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
Edit: Damn HTML parsing!
|
|
|
|
|
Hi All,
My problem is:how to get files/folder names of ftp server in C#. If any one know Plz reply.
Regards
SMK
|
|
|
|
|
Hello everyone,
I am trying to add the Speech Recognission into my Windows Application. I have added a button which activates the Speech Recognission once it is clicked by assigning two Event Handeler shown bellow:
// Get an insance of RecoContext "Using Shared RecoContext".
objRecoContext = new SpeechLib.SpSharedRecoContext();
// Assign an eventhandler for the Hypothesis Event.
objRecoContext.Hypothesis += new _ISpeechRecoContextEvents_HypothesisEventHandler(Hypo_Event);
// Assign an eventhandler for the Recognition Event.
objRecoContext.Recognition += new _ISpeechRecoContextEvents_RecognitionEventHandler(Reco_Event);
Now I would like to add a button to Disable the Speech Recognission. Can someone be kind enough to tell me how I can do this? I tried the following code in order to release the event handler but it is not doing it.
//code to realease the event handler
objRecoContext = null;
Thank you so much for your help and have a great day.
Khoramdin
|
|
|
|