Answer Questions
Can-Ann how to set precision for double value?
Hi, double dec = (double)d * 45.00 / 1023.00; In my application, there is a calcuation gives a double result. I want to display it on a label. however, the lenght of the double value is too long... How to set the precision of the double value to 3, such as 3.489 and ignore the other digits. Is there any choice for the rule as "Smaller than 5, just ignore it; otherwise, add 1 to the last element of the value". I do not know how to explain it in English... I think this should be a simple problem. However, I searched around and could not find a solution... Any suggestion for searching such basic information Thanks a lot! The better way to do caclulations is with more Decimels which is the nature ...Show All
SoulSolutions Small size image load huge memory?
Hi I write C# app has a PictureBox Control load image which formats in JPG, 9MB size, 1998px*2000px. When the app load, the memory increase ~300MB. I guest that the JPG format is converted to BMP. Am I right If it is, how can we handle this issue Thanks for any read and reply! MA. Hi, I had checked again. It arounds 54MB for 4089*3100. Thanks alot. MA. A bitmap 2000x2000 pixels would weigh about 16MB in a 32bpp pixel format, so this only accounts for a small portion of the 300MB. There must be some other reason for the memory increase you are reporting. Anyway, it doesn't matter how small the image is on disk, it will have to be decoded to some ...Show All
mahioper Webbrowser link clicked event?
I'm trying to make a tabbed webbrowser. Now I want to open a new tab, if a link is pressed with middle mousebutton, just like in IE7. But I can't find something like a webbrowser linkclicked event. Can someone tell me if it is possible to check if there is a link clicked in a webbrowser I hope that I am clear enough. Thanks in forward ...Show All
Shodin Why File Opens in Broswer Window
i'm using .net 1.1. Can somebody try to answer this question http://forums.asp.net/thread/1357943.aspx View=Flat The way ASP.NET works is that when a post-back event occures (such as a button click), the page sends the appropriate data to the server, the server updates the form and re-generates the HTML and sends it as a response, and the browser reloads the page with the new HTML. In order for you to be able to change the button's state from the server, you have to do this. However, instead of sending back the page, you are hijacking the response to send your receipt file. There really is no simple way to "fix" this. I think you need to think about your whole approach here. For starters, wh ...Show All
Prabu. Interfaces oversold???
First, I must admit that I am a C# novice and so I probably don’t have as much knowledge and experience on the subject of interface as most of you guys reading this post. After reading a few books on C# and interface design, I still can’t see and understand the real power of interface unless of course, we are talking about interfaces as a powerful concept in OOP ‘only’ and not as a powerful concept in the general sense. When I was first learning OOP I was quite suspicious about the ‘excellent features’ that OOP claims to be able to deliver to the world and I was right. For example, in reality OOP offers very little if any, code reuse. I am now having the same suspicion about interfaces even though I see a lot nice words used to d ...Show All
Dylan Smith textbox issues
Hello. I got a little program that requires a user to enter in a charicter name. Using an if statement, I got it so the user cannot just simply press the accept button and bypass entering something. The problem is that I found out that I can just simply put in a space of two and my whole if idea gets bypassed. I though about using the validating feature, but I beleave that would force me to have the user enter a name that is X charicters long and contains no spaces. Is there a way to force the user to enter something in other than just spaces there isnt such a thing :-) If then is like this: if ( condition) { //then condition here } else { //else condition here if the if condition was not true } ...Show All
pdDallas 同 How to use c # to write shrinking algorithm?
Algorithm use c # language is described shrinking Can write the code example thanks Find the next number Is this some kind of intelligence test ---------------------------------------------------------------------- resemble prize in a lottery number Where do the current numbers come from Any random number between 0-9 int i = new Random().Next(0, 9); Hi, sounds like homework :-) Mark. ----------------------------------------------------------- --This is group of data ,Judge next number through these datas What method have ----------------------------------------- 1: 019 2: 484 3: 733 4: 313 ...Show All
Jamie Ransom Problem with Sockets
Hi buddies, How are you !! I got the following problem while i am developing a chat software My software consists of two parts: Server Client each in a seperate project, and each works very well when they are working alone, but when i try to test my application -I run the server then the client- i got the problem that when the client create the TcpClient object i got this message: Only one usage of each socket address (protocol/network address/port) is normally permitted I think that is because i use the same port number for both applications but this is the only way to run both applications on the same machine. the short version of my question is: How can I start a TcpListener and a TcpClient on the ...Show All
bpsmith How to build a global connection with ODBC?
I could not create a global connection with ODBC. It needs to identify in a method, not in a class out of a method. In this case while program running, it builds and destroys million connection. In every loop in the called method creating a new connection then doing something then closing it. This condition takes so so much time. I want to optimize this. So at first I should create a global solid connection. Program should do own work with out creating new connection but with using the connection. Finally when finishing the program, connection will be closed. Could you help me Regards... Have another look; I gave two examples - the first one re-connects, as you say, for each loop encountered. The second snippet only ...Show All
alphonso error with checkedlistbox
Hi i put this code in event handler itemcheck for checkedlistbox but when execute there is error : An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll how can execute this code without error thanks if ( Control .ModifierKeys != Keys .Control) { return ; } bool shouldBeChecked; //Determine the box's current state and use to set variable to define desired state if (e.CurrentValue == CheckState .Checked) { shouldBeChecked = true ; } else { shouldBeChecked = false ; } //Prevent check change to current item from happening e.NewValue = e.CurrentValue; //Itterate through each item's index and set each item to the des ...Show All
netpicker9 Empty path name is not legal.
I'm not really sure I'm going about my problem the right way or not. What I want to to is have a save button, bring up the save dialog, and save a report from reportViewer(.rdlc) in .pdf format. The only this is, I don't show the user the dialog for previewing the report, so I can't access any of that functionality, and I know that already has an export to pdf function. I need to do this without the use of those features. Any suggestions or ideas would be a great help! Here is some code, which I know is not right at all.. private void saveButton_Click(object sender, EventArgs e) { Warning[] warnings; string[] streamids; string mimeType; string encoding; string fileNameExtension; ...Show All
IamHuM Three Dimentional array
Hi, I have created one three dimentional array,it contains some value.I want to create folder in following order C:\\DOWN\\MR\\MRDate1. C:\\DOWN\\MR\\MRDate2. C:\\DOWN\\CT\\CTDate1. C:\\DOWN\\CT\\CTDate1. that is C-->DOWN-->>MR and CT C-->DOWN-->MR-->MRDate1 and MRDate2 C-->DOWN-->CT-->CTDate1 and CTDate2 This is my three dimentional array string[,,] FolderArray=new string[2,2,2]{{{"MR","CT"},{"",""}},{{"MRDate1","MRDate2"},{"CTDate1","CTDate2"}}}; Please anyone help me.... regardsm justin Thanks for reply.It works fantastic... Regards. justin Thanks for ur reply,It works good. string[,,] FolderArray=new ...Show All
doubletree Anyway to know if the program is running under VS IDE ?
I would like to do conditional compilation based on whether the program is running under IDE, is this possible Thanks. You can't tell at compile-time whether an application will be running under the IDE or not. Maybe if you explain what you are trying to accomplish someone can offer some guidance. Hi, I understand from ure question that u want to setup a conditional complitaion only if ure runnding under Visual studio. U can do this by adding a conditional compilation only in the debug mode by editing project properties in Visual studion. Visual Studio enables multiple configurations (Debug/Release and u can add other configurations) and each one has it's own properties. So when compiling ...Show All
Tony512 Move Directory Across Volumes
I have developed an application designed to copy a directory on the D:\ drive to the C:\ drive, and I recieve a message that it can't copy across volumes using the following line of code: System.IO. Directory .Move( "D:\\WBWU" , "C:\\My Documents" ); Would that work, or am I wrong exactly! :-) here is some code I have just made up for you, hope it helps: //import the System.IO namespace private void DoCopyFolder( string source, string destination) { string [] theDirectories = Directory.GetDirectories(source); foreach ( string curDir in theDirectories) { if (!Directory.Exists(destination.Substring(0, destination.IndexOf("\\")) + curDir.Substring(curDir.Index ...Show All
eldiener Only support "DateTime.Now.ToLongDateString()" in file name?
using (StreamWriter sw = new StreamWriter((@"C:\" + DateTime.Now.ToLongDateString() + ".txt"),true)) I tried to use "DateTime.Now.ToShortDateString" and "DateTime.Now.ToString()" and "DateTime.Now.ToLongTimeString()"....however, the program will encounter problems when running... It seems the format for file name only accept "DateTime.Now.ToLongDateString()", is there any way to add the current time in the file name Or maybe I can use the log file to record the applications However, I know nothing about the log file... But I do not know which should be the format for millisecond... DateTime.Now.Millisecond.ToString("HH:mm:ss: tt"); To s ...Show All
