Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. It is probably waiting on the th.Join(); statement in Form1, not had chance to have a proper look at the code but that is where I would start.
  2. COM objects had some strange issues when dealing with threads and as part of this several different threading models existed, Single Threaded Apartment being one of them. Windows Forms only really supports COM interop when using this STA model. Even if you are not directly using any COM yourself your application might be indirectly (e.g. clipboard support) so specifying this just removes the potential for problems and should always be included. The only thing I can imagine different is going to be behind the scenes, IIRC Application.Run pretty much does the same as a normal windows message pump while ShowDialog also performs additional work required by dialog boxes such as pre translating messages. That is a bit of speculation and a bit of looking with reflector.
  3. http://msdn.microsoft.com/en-us/library/bxt3k60s.aspx might be worth a read as it covers some of the built in cell types available.
  4. Out of interest what is the code trying to do? It might be easier to replicate the end result rather than trying to duplicate the steps involved.
  5. IIRC the target site (e.g. google) needs to allow this cross domain access (this is the same if you are using a flash based app). What are you trying to get from google and could you not use their public API instead?
  6. Have you trie dsetting the parameter's direction to either InputOutput or just Output to see if that makes a difference?
  7. I should have read your original post better ;) http://msdn.microsoft.com/en-us/library/aa326475%28VS.71%29.aspx might be worth a quick look though.
  8. You could try something like TmpTime = DirectCast(sqlCmd.Parameters("@maxdate").Value, DateTime) and see if that helps
  9. If you are using the msinet.ocx then you would also need to deploy that alongside your project. Not sure about the licensing though as that control didn't ship with .Net only VB6.
  10. The file should be present on any windows platform that can run .Net as it is part of IE anyway. You might encounter problems if the versions of IE are different but you could just specify a minimum IE version in your requirements.
  11. Could you not just use the folder browse dialog instead?
  12. It is probably easier to create your own dialog rather than use the Inputbox (and the inputbox itself always looked naff and had usability issues). If you really need it though you could add a reference to the Microsoft.VisualBasic.dll and it is available through there.
  13. Are you looking at having the numbers 1 through 100 put into a random order or just 100 random numbers that could be larger than 100?
  14. http://www.xtremedotnettalk.com/showthread.php?t=83092 might be of use, although the code is vb the concepts are the same regardless of language.
  15. You could put this in a while loop e.g. Imports Okuma.CMDATAPI.DataAPI Public Class Form1 Inherits System.Windows.Forms.Form Private objMachine As CMachine Private objVariables As CVariables Private objIO As Okuma.CMDATAPI.DataAPI.CIO Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load dim CMCrunning as boolean = false while CMCRunning = false Try objMachine = New CMachine objMachine.Init() objVariables = New CVariables objIO = New CIO CMCRunning = true Catch ex As Exception Sleep(10000) End Try End While ' tmr_CheckDoorState set for 1 second - 1,000 = 1 second 'This will look for an open door every 1 second TimerIntervalUpdate() tmr_CheckDoorState.Enabled = True End Sub
  16. Try changing it to rPost.Method = WebRequestMethods.Http.Get
  17. The Main method is limited to returning an int or void - this is enforced by the runtime. Have you tried casting the unit to an int and then seeing what happens?
  18. What is this application supposed to do? Is it something the webserver needs to call or is it going to be downloaded to the client?
  19. You could use the .Trim() method on the filename and extension to remove any leading / trailing spaces/
  20. As a rule if you have a different recovery / error strategy for each of those exception types then the separate catch blocks make sense. If you are doing the same thing for any of those then it may make sense to have a more general handler for those cases (e.g. ArgumentNullException and ArgumentOutOfRangeException both inherit from ArgumentException and could be caught through their base class). Unless you are doing things involving multiple threads then a valid object shouldn't become suddenly null (unless the documentation states otherwise e.g. WeakReferences) so doing the initial check would normally be fine. Regarding the order to check - it is simply the inheritance hierarchy that dictates the order the more general exceptions are ones that are inherited from.
  21. Could you post the actual code / html please? It's a lot easier for people to offer help when there is something to look at.
  22. [PLAIN]Re: "OnPaint" flickering on text lines. can it be avoided somehow? [source code inclu[/PLAIN] Try adding Public Sub New() ' This call is required by the Windows Form Designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. DoubleBuffered = True End Sub to the form and see if that helps. Also is there a reason you are doing the call to base.CreateGraphics in the OnPaint as you could just use e.Graphics for all the drawing.
  23. Are there any errors being logged in the event log? Is the code doing anything other than the few lines above? Does the account the service is running under have permissions to run the SQLGuardian application? If this is sql server is there any reason you cannot just use it's built in scheduler to perform these backups?
  24. It won't run on your desktop though - it will run on the service's desktop (which you can't see). If you check under taskmanager is it shown as a running process? You will probably need to show processes from all users though. If the SQLGuardian is something you have written then it might be easier to turn that into a service and have a seperate app that sits in the notification area which communicates with the running service. If the app is from some other 3rd party then this is a way but a messy one (in fact MS have a tool in the resource kit called srvany.exe that does just this kind of thing).
  25. You might want to look at http://www.pinvoke.net/default.aspx/kernel32/GetShortPathName.html as a way of getting a file's 8.3 name as simply truncating to 8 characters will fail if you have many files with the same starting name. Have you looked at the StreamWriter class? This should allow you to write a text file with minimal effort.
×
×
  • Create New...