Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. The following links may be worth a look http://www.mentalis.org/classlib/class.php?id=15 http://www.codeworks.it/net/VBNetRs232.htm http://www.freevbcode.com/ShowCode.asp?ID=4666
  2. Out of interest what makes you suspect a timeout is causing the problem? What is running on the remote service (I'm guessing it is a webserver) and are you sure you are sending the correctly formatted requests to it? If you output your requests to a debugger do the ones that break the app still appear to be correct and valid?
  3. in the line m_bmpNewImage = ResizeBitmap(New Bitmap(strFileName), intPictureBoxWidth, intPictureBoxHeight) the New Bitmap(strFileName) part is probably locking the file. Try creating a temp bitmap, passing that in and disposing of the temp one to see if the problem goes away.
  4. Could you post the entire method here? It looks as though you are catching the error, setting focus back to th control in question and then continuing to run the rest of the code as if nothing had happened - you may want to exit the routine after setting the focus to the textbox.
  5. Are you getting any errors with the above code or is it just not working as expected?
  6. private int[] StringToIntegerArray(string numbers) { string[] nums = numbers.Split(' '); int[] ints = new int[nums.Length]; for (int i=0;i ints[i] = int.Parse(nums[i]); return ints; } should get you started - you will need to provide some error checking to validate the initial string etc though.
  7. Do you have any code immediately after the If statement?
  8. Just because you encapsulate your data access doesn't mean you have to return unnecessary data. Depending on the types of queries you are executing and what you are doing with the results i.e. are you doing lots of joins and returning a single DataTable or are you returning multiple tables, are you using Datasets or DataReaders, there may be ways to organise your database code to be more re-usable.
  9. Using something like the Data Access Application Block from Microsoft's Patterns And Practices site can simplify your data access code anyway. Creating additional methods to encapsulate your DB is only a little extra work for potentially much more maintainable code (plus overloaded versions of these methods can make calling with similar requirements far simpler). Too be honest you shouldn't really be hard coding SQL into your application anyway - if your DB supports stored procedures then use them.
  10. try Declare Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As UIntPtr, ByVal lParam As IntPtr) As IntPtr for your declaration
  11. You could use the code in Clicky and just delete each file rather than getting it's size.
  12. For #1 try Dim s As String s = Date.Now.ToString("T") and for #2 Dim d1, d2 As Date d1 = Date.Parse("23:43:32") d2 = Date.Parse("23:42:32") Dim ts As TimeSpan ts = d1.Subtract(d2) MessageBox.Show(ts.TotalSeconds.ToString) 'or whatever units you require although if you have the dates as a proper Date variable rather than a string you could just subtract the dates direct and format the timespan output to meet your requirements rather than converting to strings and then back again.
  13. I've seen several different recomendations from various MS sources (samples, blogs etc.) as a rule I would stick to the MS naming conventions for any externally visible members (Public or Protected) and not worry quite so much about exactly how internal naming conventions fit in as long as they are applied consistently and improve readability. I personally do tend to use the _ prefix for member variables.
  14. User.Identity.Name will return the user's login name for your web application, if you are using Windows Authentication then this will be their Windows account name.
  15. Does it just get stuck on the "waiting for asp.net to start ..." bit? If so you need to edit your machine.config so asp.net runs as the system - search through machine.config for the line that begins Then try again.
  16. If you are already using forms authentication why are you also storing the user name and access level in a variable? You can always get the username via the User object (User.Identity.Name) and you could then implement a basic group model to control access to resources.
  17. Rather than implementing your own security model you may want to look at Forms Authentication. that would give you a simple method of administering access via the web.config.
  18. Does the dataset contain any data?
  19. My C++ isn't the best but try changing the code to something like textBox1->DataBindings->Add(new System::Windows::Forms::Binding(S"Text", this->dataSet11.Tables["Managers"] ,S"Name" )); Not sure if the .Tables[] syntax is correct - the idea is to refere to the DataTable in the 2nd parameter...
  20. Objects would normally only live for the duration of the page request i.e. they wouldn't be valid on a postback. There are several possible ways to maintain state information on the server side clicky has a sample project which demonstrates several of the available methods.
  21. Could you attach the project in question - might be easier to track down what needs disposing if all the code is available.
  22. If not the image then the FileStream used to load the image may need disposing, although without seeing the loading code that could be a bit of guesswork.
  23. Did you try calling dispose on the bitmap like I suggested. Calling GC.collect is rarely the correct solution to the problem.
  24. You may want to try disposing of the bitmap object rather than just setting it to nothing.
  25. Any chance you could post the relevant code?
×
×
  • Create New...