|
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?
|
|
|
|
|
|
I wrote an application in c#, basically allows reading and editing of an INI file on a Windows 2003 server machine. On my development PC the app runs and works great. I packaged it up and deployed it to a test server and installed. No problems.
Clicking the link to run the app, nothing happens. You double click, get an hourglass for a second, then nothing.
Do I need some kind of permissions change or do I need to somehow sign my app to run on 2k3??
Also if there is a better board to post this here (I didn't see any server specific ones) let me know.
|
|
|
|
|
|
Ben, this is a very well written article. However, I am not trying to install the app from the server, I am trying to run the installed app ON the server. To be specific I install the app onto the server that hosts the ini files that need to be maintained. Once there our admins will TS over to the server to run this app for editing and verifying the INI files in question.
However, the installed app does not run on the server. It gives no error it just doesn't run. I am sure it is something similar to this but not this exactly.
Can anyone help?
|
|
|
|
|
Ok I need to have a better understanding.
It sounds like this is a windows app. Is that true?
If it is a windows app then someone has to be logged on to the server to run the windows app.
So you are saying you are logging or remoting into the server, and trying to run the app, but nothing happens?
I thought you were saying you were doing something like:
\\servername\appfolder\app.exe
If you were doing this the application is running on your PC not the server. Then my article would fix for running an exe from a server on your local PC.
Anyway, if this is something you want to run with no one logged into the server you need to create a windows service. The windows service can be set up to run at a certain time and have certain login to it has the correct rights.
I would guess currently whoever is trying to run the app on the server doesn't have rights to the folder the ini files are in, but that is just a guess.
Ben
|
|
|
|
|
Ben, this windows app would be running ON the server, not the admins PC.
However, I figured out the problem:
No ASP.NET installed on the server. The sticky part is that I can't install ASP.NET without also installing IIS. That is a violation of policy (this is a file server with SQL databases). So I can't install ASP.NET.
Is this true (I am not a server expert by any stretch)? That I need ASP.NET to execute windows apps.
Steven
|
|
|
|
|
hello,
i'm trying to cope with a couple of math calculations i need to do within my c# application. i've got two problems: first, i have difficulties translating the vocabulary to english and second, i don't know how to code it in c#.
two things i require:
1. how do I get the root of n?
2. how do I calculate the reciprocal of a number? and what is the reciprocal anyway?
and yes, i've been to school. but this is a long time ago. thanks for your help!
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
matthias s. wrote: how do I get the root of n?
You can use Math.Pow method
matthias s. wrote: how do I calculate the reciprocal of a number?
matthias s. wrote: and what is the reciprocal anyway?
Well I believe first you have to find out what reciprocal is and then start coding it. So why don;t you google?
|
|
|
|
|
thanks for your help on the first part. ad google: i did. but still, i don't understand what i've found. the explanations are cluttered with different approaches on how to deal with reciprocal - this is why i asked.
to clear things up a little, I'd like to mention, that I'm trying to do what is written here:
"To convert this value to ordinary 'Shutter Speed'; calculate this
value's power of 2, then reciprocal."
i'm just in need of a simple answer of somebody, who shares a household with reciprocal and c#
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|