I suppose you could inherit from the Panel object and implement it that way - but why would you want to put an error provider in a statusbar? I thought the whole point was they indicated controls with errors by being next to the controls with errors.
Datagrids expect the Datasource property to be .Net compatible source (DataSet, DataTable etc)
Recordsets are accessed via COM interop as a backwards compatible measure - not really intended to be used with the .Net controls.
try the following snippet and let me know if it helps.
all I've done for the array is in the declaration section
Dim names() As String = {"james", "steve", "dave", "fred"}
and the following after the forms designer code
Public Sub DoWork(ByVal nameIndex As Int32)
'Actually process the context menu selected
End Sub
Private Sub ContextMenu1_Popup(ByVal sender As Object, ByVal e As System.EventArgs) Handles CM1.Popup
Dim intNumOfNames As Int32 = names.Length
CM1.MenuItems.Clear()
Dim m As String
For Each m In names
CM1.MenuItems.Add(m, AddressOf MenuHandler)
Next
End Sub
Protected Sub MenuHandler(ByVal sender As Object, ByVal e As System.EventArgs)
Dim m As MenuItem
m = DirectCast(sender, MenuItem)
DoWork(m.Index)
End Sub
Getting a good upgrade wizard would probably be too difficult in the long run. The number of things that have changed (normally for the better in .Net) couldn't be reliably converted (ADO, File Access, winsock) due to the different arcitecture under the framework. Also a lot of API calls are now redundant - these really should be converted to .Net calls as well.
Collections / Arrays have changed, things like Queus and Stack are part of the framework now - should it also convert everybodies individual implementations of these to the framework?
Inheritance adds new scope for reuse / and design, an upgrade wizard wouldn't really know how to refactor your code to take advantage.
Personally I think a redesign of the application with .Net's capabilities in mind would ultimately give better performance AND an improved codebase.
just my two pence worth...
Too late and too much drink to look over all that (will promise to do so in the morning though)
The 'Warning: Null value is eliminated by an aggregate or other SET operation' message you are getting basically means there are NULL values in one or more of the fields you are perfoming aggregate operations on (SUM, AVG, MIN, MAX etc) - this can throw the results of some operations (AVG for example)., not sure why that should affect a sum though?
how are the tables related?
The KeyPress anly gives you the Key's character not hte underlying code. However if you use either the KeyUp or KeyDown events then the above code should work just fine.
It is better to declare the parameters as the correct type rather than Object.
Quite often the parameters were declared as any because the API could accept differrent things (string, integer, long etc) - but usually this was a pointer to the data in memory.
In VB.Net simply declare the API multiple times, specifying the correct different versions of the API.
A bit rough and ready (no error trapping for example) - but should give you a rough idea
Public Class Employee
Public EmployeeName As String
Public EmployeeID As Integer
End Class
Public Class EmployeeCollection
Inherits CollectionBase
Public Function Add(ByVal emp As Employee) As Integer
Return InnerList.Add(emp)
End Function
Public Function Remove(ByVal emp As Employee)
innerlist.Remove(emp)
End Function
Public Function RemoveRange(ByVal index As Integer, ByVal count As Integer)
innerlist.RemoveRange(Index, Count)
End Function
Default Public Property Item(ByVal index As Integer) As Employee
Get
Return DirectCast(innerlist.Item(index), Employee)
End Get
Set(ByVal Value As Employee)
innerlist.Item(index) = Value
End Set
End Property
End Class
Generally I would inherit from one of the Base classes under System.Collections.
IIRC CollectionBase for collections or DictionaryBase for a name / value pair.
It is a fairly simple matter to then provide your own type safe add / remove / item overloads that only deal with the class / interface you desire.
Just a few other things.
I notice you are opening a StreamReader in the first line of the FindName function - did you mean to?
Also within the select case statement you have a lne that reads
Case Name
should that be
Case Name1
instead?
also you appear to be doing a binary search of the data - am I correct?
If so is the data sorted? If so are the blank entries being moved to the start of the array rather than the end?
finally are you modifying the numPosts variable anywhere else in the Form_Load?
If they are just using a web browser to access you asp.net apps then they shouldn't need anything extra installing.
If the need to run a VB.Net application locally then they will need the .Net Framework installing (about 20M)
to steal somebody else's code
Try
Shell("", AppWinStyle.NormalFocus, True)
'// your code would go here
'/// i made this to purposely throw an error
'/// basically it tries to open something that doesnt exsist
Catch ex as System.ArgumentException 'Use this here
MsgBox("error: " & ex.Message) 'Also look at ex.ParamName
End Try
this also allows you to catch multiple different errors
try
'Iffy code here
catch ex as System.ArgumentException
'handle error here
catch ex as System.InvalidCastException
'handle type mismatch
end try
hope that helps