Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. You can easily get them from the arguments passed to the mouse_down event for the form. private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { MessageBox.Show(string.Format("X = {0} and Y = {1}", e.X, e.Y)); }
  2. the root namespace doesn't really mean all that much - in VB.net when you create a new project the namespace is set to the project name :confused: - all this means is if you create a class called Test - it's full name would be ProjectName.Test. To create a namespace you would simply use the namespace keyword and put your classes inside it: Namespace ProjectName public class Test end class End Namespace
  3. Although the regex works it does have a locale bias (assumes .) as decimal seperator, and will fail if a thousands seperator is specified (or if a trailing +/- is used). Also it will not cope with currency or non decimal (e.g. hex) numbers. Using double.TryParse like I suggested an Jaco showed how to do in a previous post in this thread is a easy enough way to do this.
  4. Is there any reason why you couldn't use the built in tab control? If you want to interact with the property grid then you will need to look at creating a custom TypeConverter - search MSDN for some examples (in fact you may find some in our tutor's corner or code library sections).
  5. When you say your user control has about 100 constituent controls - what kind of controls does it contain and is there nothing you can do to reduce the number? Also why would you need 200 of these visible at once? A form with close to 20,000 controls on it would seem rather a lot to say the least.
  6. Either make the label itself public - not very OO though, or create a public property that changes / retreives the label's text - much more OO.
  7. There is no C# equivalent for the vb With ... End With construct :( using is a replacement for the VB.Net imports statement and also is used when dealing with classes that support IDisposable - giving a form of deterministic cleanup. e.g. using (System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection()) { //use conn here } //connection will automatically be closed here also as an aside - if you want classes that contain nothing but static (shared in vb) methods and not allow the class to be instantiated then rather than making the class abstract (as people could still inherit from the class) you may want to use a protected constructor (that's how this is done in the framework e.g. MessageBox) e.g. public class Test { protected Test() { //not visible from calling code so cannot create a class } public static void Method1() { //Do something } }
  8. If you edit the post quick enough it doesn't show the 'edited by ....' thing. Designed for when you spot typos as soon as you hit submit - god knows I've done it often enough myself.
  9. The dll should go in a bin folder under the main application folder. If you xcopy / ftp etc the folder structure from the development machine it should work. You need to copy over the aspx, asmx, html, global.asax, web.config and any additional content (images, xml etc). You do not need to copy the resx, or .vb / .cs files to the server though. Copy the bin directory as is (all dlls in there need to be copied)
  10. If you want to download either the framework or the sdk look here
  11. Where is this code being called from? If from the Paint event then just use DrawRectanglesRectangle(e);
  12. It kind of depends on what the DrawRectanglesRectangule actually does. PaintEventArgs are normally passed to a forms Paint Event - it allows you to get to the graphics object and also identify what region needs repainting. Without knowing more about the code in question and what it does (or who wrote it) then it's very difficult to say what to pass in as a parameter.
  13. You could just call the function and pass in dummy arguments button1_Click(this, new System.EventArgs)
  14. Just use the function name and pass in any parameters it expects i.e. private void button1_Click(object sender, System.EventArgs e) { int j; j=Test(3); } //sample function private int Test(int i) { return 2 * i; }
  15. If you are not logged in then attempting to reply to a thread should bring up the login screen.
  16. You should have a look here, you should find a tutorial our very own Bucky has written on how to work with multiple forms.
  17. you may want to look here as it covers the basic ideas needed for working with multiple forms.
  18. Looks like the server is accepting the connection, sending the "Hello World" message and then closing the socket down - hence the client disconnecting. Since the socket has been closed it will refuse further requests. You might want to step through the code on the server and see what exactly happens when an inbound connection is accepted.
  19. Rather than a session you could also store the data in the Cache object - this behaves more like an application variable so the data can be accessed from multiple sessions (great for data that doesn't change much - customers, employees, products etc), the items in the cache can also`be automatically expired based on your own criteria so they do not have`to be hanging around like a session variable.
  20. If you copy the contents of strSql to the clipboard after building up this query can you then make it work in access? when you say it doesn't work - how does it not work (error messages, no results returned etc)?
  21. You would probably be better of writting a web service that runs on the webserver and expose methods that return the data - to actually access the file direct would involve opening several firewall ports (mainly the ones you don't want to open)
  22. If you are wanting to read and write to files then you would use something like: Dim fs As New System.IO.FileStream("c:\test.txt", IO.FileMode.Open) Dim b As Byte b = fs.ReadByte() ' to read a single byte Dim data() As Byte fs.Read(data, 0, 100) 'read 100 bytes. fs.Write(data, 0, 100) 'write an array of 100 bytes fs.WriteByte(1) 'write a single byte although you may want to look at serialization if you are saving things to your own file format - takes a lot of the work out of it.
  23. Baldur's gate 1 and 2 (with expansions) could easily take 100 hours apiece to finish - the amount of my life lost to those 2 games doesn't bear thinking about.
  24. You may want to look here a nice free zip / bzip / tar etc .Net library.
  25. Optional parameters are a VB specific feature and are not properly supported by other languages, in nearly all cases you are probably better of creating overloaded versions of the function.
×
×
  • Create New...