|
Enum.Parse will allow you to turn a string into an instance of the FontStyle enum.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I wannt to know how can I get previous focused control. My problem is when I click on panel then focus in textbox is lost. I have 5 textboxes and wannt set focus back to proper textbox.
I also tried OnLeave of textbox to discover which control will get focus, but I have problem too.
Any suggestion?
Thank in advance,
Jure
|
|
|
|
|
panel is only a container not any control to interact with.
Every ctrl has its index property.So make panel index prty after textbox property.
Store previous control Id to some global variable in textbox lost focus event.After you had complete ur work on clicking on panel,just use this Id and use focus() to assign focus on that control.
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
Hi friends,
I'm creating an application which deals in excel sheets...here i have a GUI from which the user can select an excel sheet...the selected excel sheet should open in the GUI itself.
Ican get that from Datagridview but the catch here is that i want to display the excel sheet exactly as it is...i mean it should should show the FORMULAE and also the formatting of the cells just as in the excel sheet...in short wht im doing is creating a Ui in which user can view and manipulate the values in the excel just as he does in the excel sheet normally...
Can any one tell me how to about this...
|
|
|
|
|
dudedotnet wrote: Can any one tell me how to about this...
Yup - you're wasting your time. If you want to edit Excel spreadsheets in a GUI just like Excel then use Excel.
Me: Can you see the "up" arrow?
User:Errr...ummm....no.
Me: Can you see an arrow that points upwards?
User: Oh yes, I see it now!
-Excerpt from a support call taken by me, 08/31/2007
|
|
|
|
|
hi i am generating a word document using c# i required the document to be formated in two colums but i dont know how to do that can anyone help me.
|
|
|
|
|
You can do this only if you have libray(dll) file for MS word class.I think you can get it from microsoft site.
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
It can be done through the Office Interop library.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi all.
We have a C# 2.0 prog writing to a csv file for emailing bills to customers.
So, we have the contents of the csv file in a string.
We use a stream writer to send it to the file.
We open the file in Excel (2003) and the £ symbol is now prepended with Ậ
Seems the encoding has turned the £ into UTF-8 and stuffed and extra charachter in there, that Excel renders incorrectly.
We tried everything, Encoding in various ways, using File.WriteText, converting to bytes using Encoding, nothing worked as expected.
In the end we settled on this:
<br />
byte[] bArr = new byte[str.Length];<br />
for (int idx = 0; idx < str.Length; idx++)<br />
{<br />
char c = str[idx];<br />
byte b = (byte)c;<br />
bArr[idx] = b;<br />
}<br />
File.WriteAllBytes(csvFileName, bArr);<br />
Pretty nasty, really.
So, question: What is the correct encoding level/object/type to use to do this more elegantly?
Thanks in advance.
|
|
|
|
|
A would guess that Excel is reading the file as an ANSI file, that is/was the standard text format in windows prior to unicode.
Try the Encoding.Default encoding, that will give you the encoding currently used by the system for ANSI files.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
I need to ping IP with linux commands "ping xxx.xxx.xxx.xxx" . and run it with Mono on Linux server.
Let's see my code...
Process P = new Process();
P.StartInfo.CreateNoWindow = true;
P.StartInfo.FileName = "ping";
P.StartInfo.RedirectStandardOutput = true;
P.StartInfo.Arguments = " 202.57.191.167";
P.Start();
P.WaitForExit();
string output = P.StandardOutput.ReadLine();
while (output != null && output!="")
{
Console.WriteLine(output);
output = P.StandardOutput.ReadLine();
Thread.Sleep(500);
}
Console.ReadLine();
Then upload and run it,it throw exception...
<br />
"Unhandled Exception: System.InvalidOperationException: UseShellExecute must be false when redirecting I/O.<br />
at System.Diagnostics.Process.Start_shell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000]<br />
at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000]<br />
at System.Diagnostics.Process.Start () [0x00000]<br />
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()<br />
at ProcessLinuxCommands.Program.Main (System.String[] args) [0x00000]"<br />
Could u help me what is this bug?
Does Mono implement the Process class?
thank =)
|
|
|
|
|
How about trying to set the StartInfo.UseShellExecute property to false as the exception message indicates.?
"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
|
|
|
|
|
Hi
I am working on a desktop application using C# and .NET 2.0.
In my DataSet I have two tables say table1 and table2. They have one to many relation (no rule is set like for update, delete or accepct/reject changes). When I drop a binding source for the parent table i.e table1 on the windows forms, I get another binding source for child i.e table2BindingSource1 after rebuilding the project. That is really helpful because when I set
//this.BindingNavigator1.BindingSource = table1BindingSource;
The self created BindingSource collaborates with the navigator itself and I need not to do any extra coding.
Now the problem is when I do
//this.BindingNavigator1.BindingSource.CancelEdit();
to cancel any changes made to DataSet in case user clicks Delete button one the Navigator.
This only works for the parent table i.e table1 and not for the child table or say for self created BindingSource.
How can I apply this CancelEdit for both the tables in the DataSet ( for both BindingSources ).
Can anybody help me out?
|
|
|
|
|
Hi, I have made a web service and when I build the application and add the Web Reference in my Windows Application, I am not getting the Begin and End Method for making Asynchronous Web service calls.
Its urgent. Kindly help. I am using C#.
-----Have A Nice Day-----
|
|
|
|
|
Did you manually create the web reference or did you use VS to generate the web reference?
If you are using VS remove the reference to the web service and delete the generated cs file. Then add the reference again, there should be no probably with this since all the async behavior is controlled by .Net on the client application side. The remote server does not need to know anything about the async behavior of the client.
If however you have created the class yourself you will need to manually add the async calls.
Here are some useful links:
http://msdn2.microsoft.com/en-us/library/d9w023sx(VS.71).aspx
http://www.c-sharpcorner.com/UploadFile/ssrivastav/UsingAsynchronousWebServices11232005071049AM/UsingAsynchronousWebServices.aspx
|
|
|
|
|
Hi,
I have done exactly according to the link provided by you. I created a webservice and added the reference in my windows application.
I then created an object of the web service class and tried to call the Begin method, but the begin method does show up. I am not able to call the Begin method of my web method.
Regards,
Neeraj
-----Have A Nice Day-----
|
|
|
|
|
Sorry my information is a little out of date. Things have changed it seems from 1.1 to 2. Anyway I created a quick test service and console app. You need to assign an event handler to the completed event for the method invoked. Then invoke the method using the async method call. The result of the method call is contained in the event args passed into the event handler.
You have to think about the race condition between the main thread and the async thread when using this method of invoking the async call.
Here is my code:
static void Main(string[] args)
{
TestConsoleApp.localhost.Test Test = new TestConsoleApp.localhost.Test();
Test.HelloWorldCompleted += new TestConsoleApp.localhost.HelloWorldCompletedEventHandler(Test_HelloWorldCompleted);
Test.HelloWorldAsync();
Console.ReadLine();
}
static void Test_HelloWorldCompleted(object sender, TestConsoleApp.localhost.HelloWorldCompletedEventArgs e)
{
Console.Write(e.Result.ToString());
}
Hope this makes sense
|
|
|
|
|
So it means there is no concept of Begin and End Methods in 2.0
-----Have A Nice Day-----
|
|
|
|
|
By the looks of it no, you will need to create a way of checking that all the async request have completed.
For more info on async see:
http://www.developer.com/net/net/article.php/11087_3481691_1
and for creating async ASP.NET pages that consume web services see:
http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/
|
|
|
|
|
Hi, All is well, but when I try to implement your Test_HelloWorldCompleted method, the HelloWorldCompletedEventArgs does not come up. I can only see the HelloWorldCompletedEventHandler.
-----Have A Nice Day-----
|
|
|
|
|
Please don't repost problems so quickly. It's unfair on others who have also posted questions. People answer questions here of their own free will, so you have to wait until they can get round to it. If it's really, really urgent, then you will have to post it on a site where people get paid to solve problems.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I am so sorry, but I thought my previous question did not explain my problem well. I will keep this in mind for the next time.
-----Have A Nice Day-----
|
|
|
|
|
assiduous wrote: I thought my previous question did not explain my problem well
Fair enough, but you should have modified that post instead.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Yea True, Sorry Again.
-----Have A Nice Day-----
|
|
|
|
|
Don't sweat it. We all make mistakes - me especially.;)
Deja View - the feeling that you've seen this post before.
|
|
|
|