flypp3r's Q&A profile
Visual C# 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! You can use the Math.Round method, which takes a double (or decimal, which I r ...Show All
Visual Basic Use of Slected ListBox Item as part of filename path... invalid Character error.
So far everyone has been of great help while I try and teach myself VB2005. I am trying to make a program that will allow people to switch between 'skin packs' for a racing game. Here's what I've got so far... The Windows form has a text box for the user to name the currently installed skins for backup. a listbox that automatically lists from a text file of all the skinpacks they have already backed up. Labels for each of the box's and a Backup/Install button. So here's the summary of what happens or is supposed to happen when the form is run. At load, text file from previous Backups is read and added into the listbox. Then the user types the name of the currently installed skinpack into textbox1, and selects a pack from ...Show All
SQL Server Pivot Tables
Hi, I'm wanting to manipulate data between two tables in the following manner. Table1 Column1 Derived Column ValueX ValueY 1 0 100 100 2 0 &n ...Show All
.NET Development ASP.NET Machine A... still present??
Hi! I know that this comes up when the .NET 1.1 is installed, but I read that the SP1 is meant to remove this I've installed SP1 via Windows Update and it's still present I've done this before and sometimes it goes and other times it stays. Is there some process I am missing, like restarting after 1.1 install or something that I am missing as I can't stand having this there and don't want to delete it or anything. Thanks! It's SP1 for the .NET 1.1 Framework. I read it should remove the ASP.NET Machine A user but it's still present. [I'm running Win XP SP2] ...Show All
Smart Device Development Getting own phone number or SMS Service Number from a POCKET PC
Hi, I'm trying to get the my own phone number from a POCKET PC 2003, in which I placed my SIM CARD. But I can't find the appropriate function. Is there a function doing this Thanks Hi, I'm having the same problem. I re-wrote this in C#, and for wm6 based pocketpc phones I get an empty string for the phone number. I get a dwAddressOffset of 228 and a leng of 2 (a unicode null terminator). Running GetPhoneNumber.exe from the WM6 SDK has the same problem. Any hints as to how to get the phone number out of the phone Is it possible at all ...Show All
.NET Development ReadAllText:
Writing a small app. to e-mail multiple recipients. First production app. I am importing system.io, however in attempting to use "file.ReadAllText" receive error message that RealAllText is not a member of system.io.file. Have upgraded to .net v3.0. What am I missing Thank you, Are you doing as below. It works fine in 3.0.. Post some sample code if you still have the issue... string str = System.IO. File .ReadAllText( @"c:\temp.txt" ); ...Show All
Visual C++ How to mashal IElementBehaviorFactory interface?
IElementBehaviorFactory* pEBFactory = NULL; //Create my com object of implementing IElementBehaviorFactory interface CoCreateInstance(CLSID_Factory, NULL, CLSCTX_INPROC_SERVER,IID_IElementBehaviorFactory, (void**)&pEBFactory); //Mashal IElementBehaviorFactory hr = CoMarshalInterThreadInterfaceInStream(IID_IElementBehaviorFactory, pEBFactory, &pStm); The return value hr is 0x80004002, why The default value of [HKEY_CLASSES_ROOT/Interface/{3050F429-98B5-11CF-BB82-00AA00BDCE0B}/ProxyStubClsid32] is {B8DA6310-E19B-11D0-933C-00A0C90DCAA9}. {B8DA6310-E19B-11D0-933C-00A0C90DCAA9} is the class id of actxprxy.dll. I think that actxprxy.dll is the proxy/stub for IElementBehaviorFactory, but I don't know why CoMarshalInterThreadInterfac ...Show All
Visual Studio 2008 (Pre-release) The project type is not supported by this installation?
VS2005 Team Suite RTM with SP1 Beta - XP SP2 - latest patches Hi, I have been learning XAML at the intro level. I had an old version of dotnetfx3 and wpf templates and I could create a project and run it. Yesterday I removed the old templates and the old framework with a removal tool and installed the RTM framework and new templates. However now I cannot open create a new project. The error message I am receiving is: "The project file c:\documents and settings\renee\localsettings\temp\4t4baj4.dyv\temp\WindowsApplication1 cannot be opened." The project type is not supported by this installation. I have not installed the extensions. I never have. I don't have enough disk space on the current system. What ...Show All
SQL Server selecting data between servers
Hello, I am using SQL2K5 and I am trying to select data from a database on Server A and insert the data to a database on Server B, using management studio. Does anyone know how to write this query. I keep getting an error expecting a linked server. Is there an easier way to do this I am avoiding SSIS for the time being, because my recent experiences with it was not good, so as a consequense I want to create a script to accomplish this task. Thank you for your time, David You can use OPENROWSET or you can create a linked server or bcp out and bcp in Denis the SQL Menace http://sqlservercode.blogspot.com/ ...Show All
Visual Basic ListBox selection subroutine
I need the code for creating a function or subroutine that will 1. count the number of items that I have in a listbox that are larger than 100 2. count the number of items that I have in a list box that are larger than 100 but less than 150. and then add these items up. 3. select certain alphanumeric from a listbox and count them... like the number of Smiths in an address book. and how to output them into a Label display box. Thanks! you didnt quite follow the code :-) you are passing into this function, intNumber which is 0. Does 0 exist in the listbox items collection If not, then it wont find it. As well as this, you are not checking, in the function, the i ...Show All
Visual Studio Team System How to create a webtest
I have a login scenario to test. The scenario is as follows The user will log in the web site. There will be passport authentication. and the user will be redirected to a new page. What i need to know is for this wherein the user will move from One web page to another and then back to the original. How should i create a webtest. Create a test project and add a new webtest to create a webtest http://msdn2.microsoft.com/en-us/library/ms182539.aspx . ...Show All
.NET Development EncryptedXml.DecryptDocument() method has thrown a exception "Unable to retrieve the decryption key."
Hi! I just copy code from Microsoft http://msdn2.microsoft.com/en-us/library/ms229746.aspx and http://msdn2.microsoft.com/en-us/library/ms229919.aspx articles, and run it... Encoding was successful but when i try to decode encrypted xml - "Unable to retrieve the decryption key." exception has been thrown Can anybody help me, please Thank you very much, I was going crazy with this. Your post solved my problem too ...Show All
Internet Explorer Development How to install my BHO?
Thanks to some help from here, I have been able to make a BHO. It is written in VB and works fine on my development machine. But it is part of a larger program and when I tested it in another computer, it did not work. Can you please verify if I am installing the BHO correctly This is how the installer deploys the files on the target machine: Program Files |---- MyApp |---- resources |---- some files |---- MyBHO |---- MyBHO.dll |---- MyApp.exe The installer also creates the following key in the registry: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects\{15E19EB0-5C29-1234-95AF-4CF76E1234B2} The guid is the guid of MyBHO.dll. The installer does not create anythign else in t ...Show All
Visual Basic Case Usage
I am pretty much a noob programmer, but I'm getting the hold of visual basic pretty much. But in one of my programming attempts something is messed up, because as far as I know my code is good... Take this code: It doesnt crash the program or anything if the guy puts letters or leaves it blank, but I could do: 1) make a masked text box 2) use cases and say that if its alphabet characters or blank then messagebox.show Write an f-ing number!!! right (im a noob) ...Show All
Visual Basic Refill a datatable?
I have this code in my vb.net program. Me.TickersTableAdapter.Fill(Me.DataSet1.Tickers) It fills the data from the external file fine. However, I'd like to be able to refill the data after it has been changed by an external program. Calling the line a second time doesn't work because I get "datareader already active on this command" error. How can I refill the data from the external file tia The only code in my form is this one: Me.TickersTableAdapter.Fill(Me.DataSet1.Tickers) I think there may be code somewhere else but I don't know how to find it in my project. thanks ...Show All
