JIM.H.'s Q&A profile
Visual C# Convert Java To C#
Hello Can anybody help me to convert this java code to c # private static int chooseOption(int min, int max) throws Exception { Scanner sc = new Scanner(System.in); while (true) { System.out.print("Enter a number: "); int option = sc.nextInt(); if (option < min || option > max) { System.out.println("Invalid number, you must enter a value between " + String.valueOf(min) + " and " + String.valueOf(max) + "!"); } else { return option; } } } private static int ChooseOption(int min, int max) { while (true) { Console.Write("Enter a number: ") ...Show All
Visual C# Buffer.BlockCopy
Hi guys, i'm having trouble with Buffer.BlockCopy. Maybe someone can help me. I have a source code with vb6 that needs to be convert to c#. This is the vb6 source code : Private Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long) Dim Key(0 to 3, 0 to 3) As Byte Call CopyMem(Key(0,0),k32(0),16) now, the k32 : k32(0) = 892876857 k32(1) = 942814256 k32(2) = 892487236 k32(3) = 842155074 and Key(0,0), Key(0,1), etc are 0. After CopyMem(Key(0,0),k32(0),16), the Key will be : Key(0,0) = 57 Key(0,1) = 48 Key(0,2) = 68 Key(0,3) = 66 Key(1,0) = 56 Key(1,1) = 52 Key(1,2) = 70 Key(1,3) = 68 Key(2,0) = 56 Key(2,1) = 50 Key(2,2) = 50 Key(2,3) = 50 Key(3,0) = 53 Key(3,1) = ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Best practices for GameComponents and GameServices
If I'm writing a GameComponent or a GameService for others to use, is it a "best practice" to auto-register the component and service during construction Or should I leave it to the consumer to register the component or service ex: public partial class MyComponent : GameComponent , IMyService { public MyComponent( Game game) : base (game) { // Should I be doing this game.Components.Add( this ); // Or this game.Services.AddService( typeof (IMyService), this ); } } PS: How can I get source code to format propery in the message editor. I checked the box that said "This post contains a code sample" Theres nothin ...Show All
SQL Server User Prompts
Hi guys I have been asked to develop a query which when run will prompt the user to enter the number of months before runnin the query. I know we can do this in MS Acess . can we do the similar sort of thing in SQL as well My query is SELECT DHBMappingTable . [DHB Name] , Agency . DHB_service , PurchaseUnitMappingTable . PU , PurchaseUnitMappingTable . PU_name , SUM ( [NMDS Data for IDF Report] . [Number of caseweighted discharges] ) AS Expr1 , AVG ( wies2 . [0607_cwd_WIES11] ) AS Expr2 , AdmissionMappingTable . Admission , wies2 . Admission_type FROM DomicileCodes In the above query, I need to multiply "0607_cwd_WIES11" with the no. of months Lets say if the user is bein ...Show All
SharePoint Products and Technologies How to Programmatically Access Wiki Content
I want to write some code that spiders my wiki and consolidates the content into a single document. I know that I can create a view that has a similar effect, however, there is no effective way to sort the view in a logical order, i.e. if I spider I can go from page to page in the same order the document is laid out. Any ideas Are you using WSS or MOSS If you are using MOSS use the Content Query Web Part. If you are using WSS, you may have to resort to some code to extract the items from the DB and present them in order... you shouldn't have to "Spider Them" but rather access a collection of the objects from the API and sort them the way you want. Hope that helps, ...Show All
Visual Studio How to show a external data into CR
Hi, How can I get the content of a textbox in a form and then put it in a label in a crystal report Regards, Hi again if i have a crystal report document called CR and u put a text control in that report called Text1 and at a form there is a control called textBox1 and i want to put the content of textBox1 into Text1 in the creystal report document. im using crystal report the came with Visual Studio 2005 thx ...Show All
SQL Server please help with order by in a view
I have make a view where i have a order by when i execute my view in modify my result are allright but when i say open view to see my view it is not in order by. I use the view in a asp site to the internet and i can't use order by here because the field i orderby shall not come up in my site, i only use this field to order by Hope someone can help Alvin Hi again and thanks I use this SELECT TOP (100) PERCENT kategoriId, kursusId, ordenummer FROM dbo.samlekursus ORDER BY ordenummer When i execute the view i modify its works all right but when i use open view it dosn't use my order by Alvin ...Show All
Visual Basic vbCrLf
Whats wrong with the following code please ListBox1.Items.Add( "Principle Interest Balance" & vbCrLf) It displays the string in between"" just fine but after that there are two open boxes Principle INterest Balance^^ Mitch I am adding to listbox to display small table of data, 3 columns numerous rows... with the following code ListBox1.Items.Add(i & AmountPaidToPrinciple & MonthlyInterest & MonthlyInterest) I need to get more space between each item(i.e AmountPaidToPrinciple etc) how do I do that oh yes figured out i dont need CrLf!!!!! but I need to make spacing Mitch ...Show All
Visual Studio 2008 (Pre-release) FlowDocument Paragraph and Images
Thanks for taking the time to read this post. I might be completely lost here at the moment, but I ran into a very annyoing problem when inserting Inlines into a Paragraph in a FlowDocument. In C# I am trying to insert an Image object into a Figure, pass that Figure as an Inline to a Paragraph and then add the Paragraph to a FlowDocument. In XAML I do: <FlowDocument ColumnGap="5" ColumnWidth="150"> <Paragraph> <Figure> <Paragraph> <Image Source="koizumi.jpg"/> </Paragraph> </Figure> </Paragraph> </FlowDocument> But in C# when I do (short version): Image photo = new Image(); BitmapImag ...Show All
.NET Development Casting Issues
I am writing a peice of code that is using WebDav to copy a file to a server over the http port. I can copy from the server to the server but I can't copy from the client's computer to the server I get the folowwing error. Can anyone help me with this. Unable to cast object of type 'System.Net.FileWebRequest' to type 'System.Net.HttpWebRequest'. System.Net. HttpWebRequest Request; System.Net. WebResponse Response; System.Net. CredentialCache MyCredentialCache; // HardCoded for testing purposes string strFolderURI = "http://10.160.68.20/webdav/testfolder3/" ; string strSourceURI = "C:\\Documents and Settings\\mathew_davis\\Desktop\\TimeCard.txt" ; string strDestURI = "http: ...Show All
.NET Development E.g of how to implement a REST webservice in .net
Hi, I've current got normal SOAP web services in .net and need to create REST versions of them. Any simple e.g.s of how to do this in .net I'm guessing i have some type of aspx page that ppl post the method and params in the query string...after e.g. of what i do with it when i receive it etc. Any help greatly appreciated Hi, Check out my blog for the approach i went with...not sure if it's the best but was simple for what i wanted to do. ...Show All
Visual Studio 2008 (Pre-release) Missing svcutil.exe after installing June CTP
I'm able to build and run Getting Started WCF sample, but don't have svcutil.exe to recreate the client proxy as described in the docs. Is there an extra install I missed Thanks I have successfully downloded following files from Microsoft for WCF June CTP. 6.0.5456.3.0.WindowsSDK_Vista_idw.DVD.Rel.img (1,193,464 KB) Setup.Exe (284KB) But when try to run setup.exe i'm getting following error message SDKSetup encountered an error: Failed to download the file http://download.microsoft.com/download/3/B/C/3BC8831B-75D4-43F0-BAC5-4574DBEBC332\SDKSetup.xml. Error - The remote name could not be resolved: 'download.microsoft.com' any pointers regarding this would be appreciated. Regards Vasu ...Show All
Game Technologies: DirectX, XNA, XACT, etc. help please Rendertarget on xbox360
i have look at this sample by Manders vs. Machine i use 2 rendertarget and it work in winxp but not on xbox360 when you graphicsDevice.ResolveRenderTarget(0); ( you get a copy of what you just have render) so you can say this Texture2d mytex = Myrendertarget.gettexture(); now i shood have a copy of the rendertarget copy from xbox fast mem to local mem stored in my mytex now shwicth rendertarget and do the same and render to a screenquad on both textures this dos not work xbox so thery u can onlye have one rendertarget on xbox one for shadow and the mesh but i what to postprocess the mesh example bluer it a bit so i need a rendertarget more we can do this on windows but not on xbox i have converted ab ...Show All
Visual Basic Can VB.NET application send msg to MSN or yahoo messenger ???
Hi All How to write a VB.NET application that allowed us to send msg to MSN Messenger or Yahoo Messenger I've added a suggestion for Microsoft to develop this as a power pack for VB.2005. Please vote for it and cross your fingers until Microsoft delivers it Please see this post for instructions: http://forums.microsoft.com/msdn/ShowPost.aspx postid=754754&isthread=false&siteid=1 Thanks, ST ...Show All
Windows Forms Datagrid Calendar
I'm trying to create a Calendar Similar to the Calendar control that ASP.net has. Basicly a Calendar that I can place text and Link buttons for the user to interact with. so what I'm thinking of doing is using a datagridview and binding it to an array. I'll do some code that determines what cell each day goes in. Now what I don't know how to do (or if its even possible) is place linkbuttons in the cells that point to a schedule form. I was wondering if it was possible to Nest Datagridviews or if it was possible to insert several Controls(Buttons,Labels,Textboxes) into a cell. I may be going about this the wrong way, so I'm open to sugestions Thanks In advance!!!! Use this MonthCa ...Show All
