Jump to content
Xtreme .Net Talk

Nerseus

*Experts*
  • Posts

    2607
  • Joined

  • Last visited

Everything posted by Nerseus

  1. Do you want to write it from scratch? If so, you don't need source code :) If you want to tweak an existing game, like Minesweeper, to learn how to write a game - you can probably search the net for a few versions. What's your level of experience? Do you know VB.NET very well and just need help with the game, or do you need help learning VB as well? -ner
  2. If you have a number and what it formatted, use ToString like the other thread mentions. If you want money, you can use ToString("c") (I didn't mention it over there). If you have a string and you want the actual number, ask :) -Nerseus
  3. I guess it depends on what you want. I'd prefer "and three", not "and zero three". I didn't look at the IntegerToWords function, but I'm assuming it's converting the "03" string to a number, which is just 3 and then converting it to the word. You'd have to look at the function in detail to change it if that's what you want. Now, if this were for decimal calculations, not money, I'd agree that might want it "and zero three". Then again, you'd probably want the word "cents" on the end and also say "and no cents" if the number were "1.00". Since you have the source code, you can modify it however you (or your clients) want. Also, change that name from IntegerToWords to NumberToWords or something. I say "NumberToWords" instead of "DoubleToWords" (which would match the type) because you may want to overload this eventually to take other datatypes. -Nerseus
  4. You can also use ToString("n2"). Increase the 2 if you want more/less decimals. Use ToString("f2") if you want the 2 decimals but no commas. -Nerseus
  5. Before you restore you have to manually clean up any resources defined in a pool NOT part of managed (can't remember the enum to look for offhand). That may or may not be your problem. Have you run dbmon, a tool in the SDKs bin folder, to see what it shows as an error? It often gives more detailed info about DX errors. -ner
  6. On the Checkbox's DataBindings collection, you can add Format and Parse event handlers. Look at the docs on how to set them up. Essentially, Format translates data coming from a DataSource into a format you want for the control and Parse translates data coming from the control into a format the DataSet wants. -ner
  7. You have a number of options for printing. You can use a reporting engine and code such as Crystal (a report designer that reads data - from a DB for example - to populate the reports). You could use a 3rd party to do printing for you (such as a set of classes that create Adobe PDFs, or transform XML into Postscript for sending to a printer). You could also use the built in printing objects to do all the printing yourself, including print preview and more. It depends on the complexity of what you're printing, how much money you have to spend on 3rd party tools and how much time you have to spend to get your solution. -nerseus
  8. Assuming the manual looping works, how slow is it? Assuming you have 2000 rows and you have to loop through each one to find the right name, is it so long that the users will notice? Maybe it's not as "clean" as a simple Find method, but if it works at a good enough pace why not use it? Try something like: Dim dr As DataRowView Dim i As Integer = 0 For Each dr In dv If (dr["EmpName" = "Dan") Exit For End If i = i + 1 Next My VB.NET isn't that good, but I hope you get the idea. I don't know if that will work with the sorting or not... -Nerseus
  9. Traditionally, I've given clients one of the following : 1. SQL script that they must run in manually (db.sql or similar) 2. I call out to isql.exe (or osql.exe?) during a setup 3. Custom code to create a DB through COM (SQLDMO I think). 4. A database backup of a stripped down version of the DB. Number 4 works great if you have some system look tables that need to get in. I prefer number 2 but I use a custom built setup application. Since this is a one time thing usually (creating the DB), you can always put it in as part of the setup notes assuming your clients read them (or better yet, YOU do the installs). If they're savvy enough to use Query Analyzer, a simple script would work but if you don't have any system tables, you could have them use Enterprise Manager to create the DB with all the defaults. Using a script has issues since you'll have to specify a local path (C:\MSSQL\...) for the DB and Log files. -Nerseus
  10. What kind of programming experience do you have? Can you create a Windows EXE project? Do you know how to create controls and add event handlers? Do you know about variables and classes? If you answered "no" to any of these, I'd suggest reading some online tutorials, the MSDN help, or getting a book first. These forums are a great place to find answers, but answers to specific questions not "How do I write a program that does ___ ?". -Nerseus
  11. If you need it fast, I'd use an XmlDocument. You can use the load method to load a file directly and use XPath to get at your value. You can use something like: doc.SelectSingleNode("//Site") or doc.SelectSingleNode("//Site").Attributes.GetByName("Name') The last line isn't right, I can't remember the syntax for getting attributes from an XmlDocument. I can't help with XmlTextReader as I haven't used it in ages - but you wanted something fast. -Nerseus
  12. Slightly off-topic: I've never seen Convert.DBNull - is that VB-specific, or just another way to get at DBNull? In C# it's System.DBNull.Value. I'm just wondering if it's like int and Int32 in C# or Integer and Int32 in VB.NET (the same object, just used two different ways - or 4 if you count different languages). -nerseus
  13. Ooo... sounds interesting :) Any link to a site that has more info (or info on what the next version of .NET might have in general)? :) (Two smilies for the price of none) -Nerseus
  14. I've been doing some work with C++ the last few weeks and I'm really liking the idea of templated code. For example, you can write a template for a function named "swap" and define what it does, then use that swap function for ANY class you want. At compile time, the compiler substitutes in the class-specific version of the function/code for each class type, optimizing things for you. Also, if you have a larger function than swap and need it for multiple class types, you don't have to rewrite it (only changing the class types). Any word if any new version of C# (whidbey or it's next version) have that support? I know it's probably not high on their list, but seems like an easy thing for a compiler to do (I can say that since I'm in the market of making compilers :)) -nerseus
  15. What exactly are you putting the labels? If you have a fixed number of labels and you expect the text in txtInput to be in a certain format, then I wouldn't use a loop. Normally you would only use a loop to fill controls if the data is unknown and expected to be dynamic (such as if you were reading in an unknown number of fields from a file). If your textbox is to take, say, a first and last name and you want to fill two lables, then don't use a loop to fill each box - hard-code the filling of each label based on however you split the name typed in. -Nerseus
  16. If you have the value in a DateTime object (or in a column in a DataSet cast as a DateTime), you can use the DateTime's ToString overload to specify the format, such as: string s = dateVal.ToString("dd/MM/YYYY"); I think I saw another thread here where someone did something simpler (such as changing a DB option or using the built-in localization objects - or is it globalization, one for UI one for code -can't rememember). -nerseus
  17. Hmm... I don't know of any way to get the built-in DataView to limit rows to distinct rows. If you need this distinct view for binding purposes, I think you may have to go another route such as creating a new DataSet with the filtered data or use a custom binding object such as the JoinView. The JoinView is a new object that MS wrote, available through MSDN online for free, that shows how to implement a new DataView-like object. You can use it to bind to a JoinView object which would show two tables in a DataSet as one table for binding purposes (such as showing parent/child data in one row). If you have to go a custom route, at least there's that sample which shows how to create a bindable object. :p -nerseus
  18. I agree in that the Find seems to be stricken with some problems like the one you mention. It's too bad the BindingContext doesn't support some better way to get to a row than an ordinal position. Luckily for me (unlucky for you maybe), I haven't had to do this kind of binding - I generally use grids when showing more than one row. Or when showing only one row at a time but I need paging, I've had alternate solutions (like also using a grid to select the desired row - which updates the binding context). If you do find an answer, please post. I seem to recall hearing this type of question asked before. You might also try the MS forums, especially the one for Data, to see if anything shows up there. -nerseus
  19. If you use uniqueidentifier, you have to insert the identifier yourself (using a function I can't remember the name of right now - getguid or something maybe?). It's not like an identity column which is auto-generated. So if you go that route, create your tables in SQL Server then loop (custom code or a SQL script with a cursor) and create/insert keys. This brings up a question though. Since you can't identify any set of columns to get a unique row, how would you update an already inserted row with a uniqueidentifier? Meaning, how would your code uniquely identify a row to do an update on? If you're manually (through code) copying rows from your Access DB to SQL Server, then you can insert the uniqueidentifier at the time you insert the row into SQL Server. In that case, you could use the WinAPI to generate a GUID and convert it to a string for the insert. If you're manually copying rows, you could also use an identity column and have SQL Server do the updating for you. The following quote has me worried for you: I take it you might be loading an Access database more than once? Or maybe merging multiple access DB's into one SQL Server? Without having any way to identify one row as being different from another, I don't know how you'd do the merge (assuming you need any kind of way to match up existing rows). This might not be an issue but it at least raises some flags in my mind. -nerseus
  20. You'll want to wait on the process to finish (I would assume). I can't recall offhand what it is though - does the Process.Start method have any extra params such as wait til exit? If not, you may have to find out how to wait on a handle until it closes (sounds familiar, like I've done that before?) - the handle being returned from the Start method I think. Sorry for the vaguness, I'll look into it more in the morning if you still need help. If you can't find a way to wait using .NET, here's a link to doing it using the API (non-.NET code, sorry): http://www.thescarms.com/VBasic/wait.asp -nerseus
  21. Assuming each CD object knows how to save itself (you'll have to code that), you can have the method loop through the arraylist and have each one save itself. Do you need help with filehandling (opening and writing to a file), how to get the CD object to save it's own data, or...? -Nerseus
  22. OT sorta: Ugh, I hate that formatting - the same thing messes up my XML formatting (in XML files and XSDs). You can still manually format if you want, through Edit->Advanced->Format Document (which doesn't appear to remove the line you listed). -Nerseus
  23. Although I can't help you exactly, I can mention that there is also a bit of room between lines for readability. You couldn't want one font directly on top of another (not usually). I have no idea how that little extra margin is calculated though. Consider it similar to a double spaced document. The single spaced document still has a little extra room between lines. I wonder if the MeasureString method of the Graphics object (I think) can calculate heights? I seem to recall it returning a Rect structure, which would imply it does. You could try that instead of figuring out the height of one line. -Nerseus
  24. @Robby: And what's an "amin"? I hope it's a good thing, for lebb's sake :) -nerseus PS I can't speak for the forums, but my work is right at the 10% mark. Now if you count ALL the staff, including QA and Business Analysts, it's closer to 50%.
  25. I can't wait for Whidbey and yukon to go gold. Even 1.1 of Visual Studio is buggy enough to cause me hours of lost time (when it "eats" my control properties on inherited forms for instance). Ah well, in the middle of upgrading to a "2.0" of some 3rd party controls this week - can't handle too many upgrades at once! -Nerseus
×
×
  • Create New...