|
object[] MyFunction()
{
}
|
|
|
|
|
public string[] myfunction()
{
string[] myarray = {"test","test","Test"};
return myarray;
}
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
saqib82 wrote: tell me how to return an array from a function???
But What is the type of the array
string[] function()
int[] function()
IF you don't what will the type then check for Generic new in Dot net Framework
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Haven't handled arrays in generics, but here is an article[^]
An excerpt shows this:
23 // output array of all types
24 static void PrintArray< E >( E[] inputArray )
25 {
26 foreach ( E element in inputArray )
27 Console.Write( element + " " );
28
29 Console.WriteLine( "\n" );
30 }
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Yes but i think the function you have written is similar to genric
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
|
hi every one,
just wanted to know how can we make a text box or a datagridview column in a windows application display 3 digits after the decimal point. Does it have some thing to do with SQL Server or u can just do it on the Application end.
2) please tell me how can we restrict a text box to take input as a numeric data. I can restrict this using KeyPress event but I got a bit googled when I thought I should take floating point number for an input. the problem is that the user can input the decimal point more than once... so how can we stop that from happening
thanks in advance
Rocky
|
|
|
|
|
Why don't you just use the numeric control?
If you don't want to do that, then you can use the [textBox].DataBindings[0].Parse, and [textBox].DataBindings[0].Format events to handle how data is manipulated between the datasource and presentation layers.
|
|
|
|
|
Rocky71 wrote: display 3 digits after the decimal point
the ToString function of decimal does it. But you will need to pass format as a parameter.
Rocky71 wrote: 2) please tell me how can we restrict a text box to take input as a numeric data. I can restrict this using KeyPress event but I got a bit googled when I thought I should take floating point number for an input. the problem is that the user can input the decimal point more than once... so how can we stop that from happening
search for validating decimal number or you can use maskedtextbox
|
|
|
|
|
Rocky71 wrote: just wanted to know how can we make a text box or a datagridview column in a windows application display 3 digits after the decimal point. Does it have some thing to do with SQL Server or u can just do it on the Application end.
You could format the string in the application using the ToString() method.
Rocky71 wrote: 2) please tell me how can we restrict a text box to take input as a numeric data. I can restrict this using KeyPress event but I got a bit googled when I thought I should take floating point number for an input. the problem is that the user can input the decimal point more than once... so how can we stop that from happening
Have a look at these articles on codeproject[^]. You could capture the decimal point keypress by using a boolean variable and handle the subsequent decimal point keypress by checking the boolean field. OR You can use regular expressions.
|
|
|
|
|
Hello,
1) As nobody seems to give you the code I will do that
string _actualvaluestring = String.Format("{0:F3}",_actualvalue);
or dynamic over in int value
int decpoint = 3;
string _actualvaluestring = String.Format("{0:F"+ decpoint.ToString() +"}",_actualvalue);
2) Like suggested, you should look at the articles here on CP
All the best,
Martin
|
|
|
|
|
Use a regular expression in your validation
Floating point Regex
[-+]?[0-9]*\.?[0-9]+
Floating point with scifi notification
[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?
"In quiet and silence, the truth is made clear."
|
|
|
|
|
thanks a lot Mike.. this looks quite helpful to me... and thanks every one else too. I'll try that in a while
|
|
|
|
|
Hello,
I'm allways interested in a feedback, specially if my suggestion doesn't get your or somebody elses acceptance.
Thanks for taking time
All the best,
Martin
|
|
|
|
|
Hello there Martin,
well your suggestion wasnt bad at all u know. and those CP articles proved worth it. if there had been a facility to say thanks to all people who participated in the thread, it would have been real nice dont u think.
Cheers...
Rocky
|
|
|
|
|
Hello Rocky
Hope you didn't missunderstood what I wanted to ask for.
It is not that I was waitung for a "thank you". (I did of corse see that you got a lot of replays which where all very simmilar)
But what I do like is a statement from those people who down vote (3) my answers.
It's really not that I do care much about my votes, it's just curriosity why my suggestions are bad.
In fact I like to answer questions here on CP because there are a lot of experts who lett me know if there is a better solution, which is also importend for my work.
So if I got downvoted for an answer I'm a little worried cause mostly I'm also using same thing in my projects.
So I'm really sorry if you fellt under pressure to say thank you.
Cheers to you as well!
Martin
|
|
|
|
|
I autohide the taskbar and maximize a form in a .net 2.0 application. When i take the cursor to the bottom i am unable to see the taskbar. When i go to any other open application it is visible. But in my application it is not visible.
Can any one tell me what can be done?
|
|
|
|
|
pranu_13 wrote: I autohide the taskbar
Which task bar ? VS 2005 IDE i think
Go to Views you will able to see all items
Select which you want to see
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
hi all,
i am using using webbrowser control to connect to server from my application
for that i am using webbrowser control
but before that i need to check wethere it is conncted to internet or not
hw to do this,
please help me
|
|
|
|
|
|
Hi. I've developed some .NET2.0 C# code below that allows me to create eMail messages in Outlook. I am interested in changing some of the read-only properties, such as sender, sent & receive time. My goal is to recreate an old eMail profile from an XML data source. I DO NOT want to send altered eMails.
My code listed below receives a “read-only” error message
Thanks for reading.
Rob
using Outlook = Microsoft.Office.Interop.Outlook;
Outlook.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon(Missing.Value, Missing.Value, true, true);
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMsg.Subject = "Test";
oMsg.HTMLBody = "<title>testtest";
oMsg.To = "Rob Hess<rhess@beringer.net>";
oMsg.ReceivedTime = Convert.ToDateTime("10/10/2004 10:00:00 AM"); //error below
oMsg.SenderEmailAddress = "Support@beringer.net"; //error below
oMsg.SentOn = Convert.ToDateTime("10/10/2004 10:00:00 AM"); //error below
oMsg.Save();
oNS.Logoff();
Error Message:
Error 3 Property or indexer 'Microsoft.Office.Interop.Outlook._MailItem.SentOn' cannot be assigned to -- it is read only
|
|
|
|
|
I would suggest not using Outlook interop. Look at the System.Web.Mail namespace.
|
|
|
|
|
Thank you for the suggestion.
I am not looking to send eMails to a SMTP server. I want to recreate eMails directly in my Outlook profile.
For Example:
I have an XML file created from a 3rd party eMail application:
<to>rhess@beringer.net
<from>support@beringer.net
<received>April 12, 2001 12:12:43
<subject>hello
<message>Test
<folder>Saved
I want to read this info & recreate this eMail in Outlook. It appears that Microsoft.Office.Interop.Outlook limits me to creating new eMails & either sending them or saving them as a draft. The System.Web.Mail only allows me to send eMail directly to an SMTP server.
Is this even possible?
Thank you for reading.
|
|
|
|
|
Hi,
See as the error describes the three properties "ReceivedTime", "SenderEmailAddress " and "SentOn" are readonly. You will not be able to set this. These fields will be get updated automatically when you send this mail.
Manoj
Never Gives up
|
|
|
|
|
Can we set the "Overwrite events as needed" property of windows event logs programmatically?
|
|
|
|