Jump to content
Xtreme .Net Talk

Grimfort

Avatar/Signature
  • Posts

    59
  • Joined

  • Last visited

Grimfort's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I dont know what you mean when you say "create your own". All the editor does is save you typeing it youself, this is not exactly a new find ;). Whats the difference you say, nothing. You will never notice its such a small command, its probly 1 extra instruction and as your CPU does about 25 million a second im not sure it will care :). In case your interested, just run to the end of the procedure line and add handles me. and you will get a list of all the controls for you to pick from and also classes that are declared globally. You can actually do some really cool stuff, like move the handle of a control to a different procedure then the one it was defined at designed time. Heres an example. AddHandler Application.ThreadException, AddressOf eh.OnThreadException Also, you can use the same procedure to handle many objectes, ie same event for 2 menus, ones a normal menu, the other is a popup menu. Private Sub mnuDeleteMenu(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mncConnRemove1.Click, mncConnRemove2.Click
  2. Or you could overload the exising function: 'Calling code Dim thing As New Form2 Dim strData As String thing.ShowDialog(Me, strData) MsgBox(strData) 'Code to put into the dialog form Public Overloads Sub ShowDialog(ByVal Owner As System.Windows.Forms.IWin32Window, ByRef strData As String) MyBase.ShowDialog(Owner) strData = "show me the money" End Sub
  3. Why dont you just check if the user is tying to change to that tab, and just move them back to the old one ?
  4. Yes, the search button is your friend :).
  5. Please dont think I am putting you down, but I think your are lacking the major concept of coding workflow. I would suggest reading up on things like: Properties, Variables, Classes. Basic functions like , If, For and Concatenations (joining together data). Lookup tutorials, there are many good ones for beginners. Also, if your doing this to learn (rather then just making a program), have a really good crack at working it out for yourself and using examples. You will not learn by copying and pasting someone elses code.
  6. You can use the properties: Integer.MinValue Single.MaxValue Double.MaxValue (etc etc) to get this. Integer min = -2147483648 Integer max = 2147483647 Single min = -3.402823E+38 Single max = - 3.402823E+38 Double min = -1.79769313486232E+308 Double max = 1.79769313486232E+308
  7. This is soooo going to be used for a hack attack :) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strNext As String = "0.0.0.0" Dim intIndex As Integer For intIndex = 0 To 100000 Debug.WriteLine(strNext) strNext = funcNextIPAddy(strNext) Next End Sub Private Function funcNextIPAddy(ByVal strIPAddy) As String Dim intIndex As Integer Dim intRev As Integer Dim strSplit() As String = Split(strIPAddy, ".") Dim bytIP(3) As Byte 'Just to make sure it works ReDim Preserve strSplit(3) Dim bAdded As Boolean = False For intIndex = 3 To 0 Step -1 bytIP(intIndex) = funcFixByte(strSplit(intIndex)) If bAdded = False Then If bytIP(intIndex) < 255 Then bytIP(intIndex) += 1 bAdded = True For intRev = intIndex + 1 To 3 bytIP(intRev) = 0 Next End If End If Next Return CStr(bytIP(0)) & "." & CStr(bytIP(1)) & "." & CStr(bytIP(2)) & "." & CStr(bytIP(3)) End Function Private Function funcFixByte(ByVal Data As String) As Byte Dim intVal As Integer = Val(Data) If intVal < 0 Then intVal = 0 If intVal > 255 Then intVal = 255 Return CByte(intVal) End Function
  8. This is a simple class that holds data, and has one function to show you use. The function just returns the name of the object (its a document) in uppercase. There are LOADS of excellent reasons to use classes, but just think of each class as a new box. You stick stuff in it (the private variables normally) and then ask it for data back. You can tell the box to do something to the data, like return in upper case, or run functions based on the data. Its also good for passing it data in one format (ie a string) and it can convert to another, or using properties, you can allow an integer to be added to the class, but only if its greater then zero. If your just getting into how classes work, then keep away from inheritance, overriding, overloading and scope of things until you know how (and where) to use them. Another thing to note, is that everything is really a class. A form is a class (it inherits all its functions), a module is a class used once (singleton), controls are instances of classes. Friend Class clsDocument 'Unique ID Private pUniqueID As Integer 'Name of document Private pName As String 'Owner of this document Private pOwner As Integer Friend Sub New() 'Set the defaults pUniqueID = -1 pName = "" pOwner = -1 End Sub Friend Function funcGetNameUpper() as String return pName.ToUpper() End Function End Class
  9. OO I forgot to add. The best way to start is to get youself a programmng with API book (dan applemans book is a must) which has a complete section on controlling windows applications via the API.
  10. It will take you ages to come up with something with 10% of the stuff that winbatch can do. We are in the same boat, but have 4 developers experienced in .net, but still use winbatch as it saves a shedload of work. If your doing it for other reasons (like to learn) then good luck, but from a business view its a lot of output for not much input, if you get my meaning.
  11. Yer, I have a good idea how to do the actual working out by hand, just wanted to know if any1 can think of an easier way (ie get the data functions to do it).
  12. Does the word, hack, mean anything to you :) You can use the .net remote debugger to control and edit apps in a domain environment, but in answer to your question dunno :).
  13. .Net applications do run on windows 98, its just the environment that must have NT technology to run. If you search the MS site you can get a list of what the requirements are for the older OS systems, ie NT4 with service pack 6.
  14. Heres a snippet of code that traps any errors running on the application thread. It does let some by (sub threads of other threads) but gets most. Dim eh As CustomExceptionHandler = New CustomExceptionHandler() ' Adds the event handler to the event. AddHandler Application.ThreadException, AddressOf eh.OnThreadException ' Creates a class to handle the exception event. Private Class CustomExceptionHandler ' Handles the exception event. Public Sub OnThreadException(ByVal sender As Object, ByVal t As System.Threading.ThreadExceptionEventArgs) Dim result As DialogResult = System.Windows.Forms.DialogResult.Cancel Try result = Me.ShowThreadExceptionDialog(t.Exception) Catch Try MessageBox.Show("Fatal Error", "Fatal Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop) Finally Application.Exit() End Try End Try ' Exits the program when the user clicks Abort. If (result = System.Windows.Forms.DialogResult.Abort) Then Application.Exit() End If End Sub ' Creates the error message and displays it. Private Function ShowThreadExceptionDialog(ByVal e As Exception) As DialogResult Dim errorMsg As String = "An error occurred please contact the administrator with the following information:" & vbCrLf & vbCrLf errorMsg &= e.Message & vbCrLf errorMsg &= "Stack Trace:" & vbCrLf errorMsg &= e.StackTrace & vbCrLf Return MessageBox.Show(errorMsg, "Application Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop) End Function End Class
  15. I guessed its when you run the program. Its not likely to happen at any other time now is it :) The endtime parameter does not appear to be filled in, is it ment to be empty string, or nothing (just for you to check). Im guessing that your not actually using a date field in the database, but rather a string field (is this what you want ?). One idea I do it print out the completed string into the debug window, and copy and paste it into access or SQL and test to see if the SQL statment is valid: ie: Debug.Print MyCommand2.CommandText
×
×
  • Create New...