|
Ben Fair wrote: If your collection implements ICollection you can load it into a List via one of the overloaded constructors.
Thanks, worked like a charm.
I appreciate all the help and suggestions from everyone.
|
|
|
|
|
When adding to the collection, you can specify a key at the same time (if VB.NET) :
myCollection.add(objObject, strKey)
The key must to be unique, so the ID of the object being added will work fine. You can then get to items in the collection using the unique key:
myCollection.item(strKey)
|
|
|
|
|
We talking .Net collection?
You could use a built in system.collections.specialized collection
If you need something really fancy, create something yourself implementing iComparer and come up with ever sort you need. Do a google search on custom search iComparer.
Cheers!
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Will do,
thanks to everyone for your suggestions, they where all extremely helpful.
Cheers to the community
|
|
|
|
|
Hi.
I have a question regarding the capuring of a picture via WebCam. I searched for some samples, but none could provide on how to get the picure in its full size - megapixels.
Any help?
Regards,
Matjaž
|
|
|
|
|
That has nothing to do with VB.NET.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Someone at work told me that you can change code that would normally look like the following:
Using certainObject as new Object
Using anotherObject as New Object
Using somethingElse as new Object
'Do stuff
End Using
End Using
End Using
into this:
Using certainObject as new Object, _
anotherObject as New Object, _
somethingElse as new Object
'Do stuff
End Using
I know that VB.NET does something strange when you dimension multiple variables on the same line - ex. Dim str1, str2, str3 as String , I guess Dim str1 as String, str2 as String, str3 as String would be proper. Because of that I am unsure if it is truly proper to format the code with the second code example.
Is one more correct than the other or is this just simply a preference thing?
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
Don't know about VB, but that won't work in C#.
|
|
|
|
|
CleaKO wrote: is this just simply a preference thing?
Both are correct and do the same. It is a preference thing.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
It's just a matter of preference. They both work the same, though, the nesting gives you a little more readability if you're using multiple objects and need them at different levels.
|
|
|
|
|
CleaKO wrote: Is one more correct than the other
there is no such thing as "more correct"; a statement is correct or it is not correct.
|
|
|
|
|
Technically in the example, does Object have a dispose method?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
kissdznuts wrote: does Object have a dispose method?
No, System.Object does not have a Dispose() method, so it does not implement IDisposable.
In C# you could make your own Object class, distinct from System.Object; however in VB.NET that seems not possible.
|
|
|
|
|
How to Disable the Close button or Remove the Close in Windows Forms!!!
Can anyone suggest me or Help me?
Regards...
Selva Shankar
|
|
|
|
|
If you mean the "X" in the right corner you can just set the form property "ControlBox" = False.
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
HI Cleako,
Thanks for answering....
Your suggestion removes all the three buttons.But i need like Minimize button should be enabled,Maximize and Close buttons in Disable state.
Is there any suggestion or code with you?
Regards...
Selva Shankar
|
|
|
|
|
For disabling, you will need to paint the form yourself.
Cleako's reply would remove all the buttons in the control box.
Loading signature. Please wait...
|
|
|
|
|
Hi d@nish,
You are absolutely right for the cleako's answer.
Is there any other way except painting a new form?? B'coz, all my works in the application are over except this. if i paint a new form then i need to start from beginning.
Regards...
Selva Shankar
|
|
|
|
|
This is handled in User32.dll . I think there is GetSystemMenu function(Not sure about the name). Try dig in to it. You might find something useful.
[Edit]I hadn't gone through the code in post below. But that exactly what I was thinking.[/Edit]
Loading signature. Please wait...
|
|
|
|
|
You do not want the close the form at all? Then you could just cancel the close in the event fired when the X is clicked.
If you need to close the form using some other interface - a button for example, use a tag to show the path for the close event, and handle accordingly.
HTH
|
|
|
|
|
Maybe this will help. The original code came from this site
Jan
Option Explicit On
Public Class Form1
Private Declare Function RemoveMenu Lib "User32" (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer
Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Integer, ByVal bRevert As Integer) As Integer
Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Integer, ByVal nIndex As Integer) As Integer
Private Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hWnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
Private Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Integer, ByVal wFlags As Integer, ByVal wIDNewItem As Integer, ByVal lpNewItem As String) As Integer
Private Const MF_STRING = &H0
Private Const MF_BYCOMMAND = &H0
Private Const WM_SYSCOMMAND = &H112
Private Const MF_BYPOSITION = &H400&
Public Const MF_SEPARATOR = &H800&
''' <summary>
''' Wis een commando via 0-based volgnummer in het systeem menu
''' </summary>
''' <param name="frm">De form van het systeem menu</param>
''' <param name="iPosition">De postitie 0-aantal -1</param>
''' <remarks></remarks>
Private Sub RemoveControlMenuItemByPosition(ByVal frm As Form, ByVal iPosition As Integer)
Dim iHSysMenu As Integer
Dim iReturn As Integer
Dim lDW As Long
Dim lRR As Long
iHSysMenu = GetSystemMenu(frm.Handle, 0)
iReturn = RemoveMenu(iHSysMenu, iPosition, MF_BYPOSITION)
lDW = GetWindowLong(frm.Handle, -16) 'Window style
lDW = lDW And &HFFFEFFFF 'Turn off bits for Maximize arrow button
lRR = SetWindowLong(frm.Handle, -16, lDW)
End Sub
Private Sub RemoveControlMenuItemByCommand(ByVal frm As Form, ByVal lCommand As _
Long)
Dim iHSysMenu As Long
Dim iReturn As Long
Dim lDW As Long
Dim lRR As Long
iHSysMenu = GetSystemMenu(frm.Handle, 0)
iReturn = RemoveMenu(iHSysMenu, lCommand, MF_BYCOMMAND)
lDW = GetWindowLong(frm.Handle, -16) 'Window style
lDW = lDW And &HFFFEFFFF 'Turn off bits for Maximize arrow button
lRR = SetWindowLong(frm.Handle, -16, lDW)
End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m) 'moet altijd hier staan
Const WM_HOTKEY As Integer = &H312
Const WM_COMMAND As Integer = &H112
Select Case m.Msg
Case WM_HOTKEY
Case WM_COMMAND
Select Case m.WParam
Case 2
MsgBox("You clicked to About")
Case 3
MsgBox("You clicked on Help")
Case 4
'This option removes the custom added menu items and the separator.
Dim iHSysMenu As Integer
' Dim iReturn As Integer
iHSysMenu = GetSystemMenu(Me.Handle, 0)
Call RemoveControlMenuItemByCommand(Me, 1) 'nrs moeten overeenkomen met aanmaak
Call RemoveControlMenuItemByCommand(Me, 2)
Call RemoveControlMenuItemByCommand(Me, 3)
Call RemoveControlMenuItemByCommand(Me, 4)
Call RemoveControlMenuItemByCommand(Me, 5)
Case 5
Call RemoveControlMenuItemByPosition(Me, 0)
Case 61587 'systeemmenu
Case 61458 'titelbalk
Case 61472 'minimaliseer
Case 61728 'restore
Case 61488 'maximaliseer
Case 61490 'dubbelclick titelbalk
Case 61456 'verplaatsen
Case 61440 'size menu
Case 61441 'size left
Case 61442 'size right
Case 61443 'size up
Case 61444 'size left up
Case 61445 'size right up
Case 61446 'size down
Case 61447 'size Left down
Case 61448 'size right down
Case Else
MsgBox("You clicked item " & m.WParam.ToString)
End Select
End Select
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim iReturn As Long
Dim iHSysMenu As Long
iHSysMenu = GetSystemMenu(Me.Handle, 0)
'nrs moeten overeenkomen met wndproc
iReturn = AppendMenu(iHSysMenu, MF_SEPARATOR, 1, vbNullString)
iReturn = AppendMenu(iHSysMenu, MF_STRING, 2, "About...")
iReturn = AppendMenu(iHSysMenu, MF_STRING, 3, "Help...")
iReturn = AppendMenu(iHSysMenu, MF_STRING, 4, "Remove new items")
iReturn = AppendMenu(iHSysMenu, MF_STRING, 5, "Remove 1st item")
End Sub
End Class
|
|
|
|
|
how to search a particularfile from a folder.
I having a MS acces table containing two fields, files name and modification time. Want to read file name by name from table and want to check that file to be present in the folder and to compare that files modified time and time in table to be equal or not.
How to do these
denny
|
|
|
|
|
hi
add a reference to the Microsoft Scripting Runtime library:
C:\WINDOWS\system32\scrrun.dll
regards
|
|
|
|
|
Check out FILEINFO as it will give you what you need.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi all,
i am using master page in my project..
i am getting design issue...
it's working properly for IE, when it come to Fire fox,it not showing properly.how to fix it.
please help me..
Thanks in advance.....
JohnDas
|
|
|
|
|