|
hi
I M using Arraylist to store values. i want to find the most frequently occurring, or repetitive, value in an array (ie Mode of the array).
Please help.
thanks
|
|
|
|
|
You need to step through the array and count the objects. You shouldn't use ArrayList if you can help it ( i.e. unless you're in the .NET dark ages of 2002 or 2003 )
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I m using dot net 2005.
I can use other alternative of array list.
What is the best way to find the most frequently occurring, or repetitive, value in an array with less complexity in program.
thanks 4 reply.
|
|
|
|
|
OK, then you should never use ArrayList. Use the generic collections.
List<T> has a number of methods you can use. You can use findall to figure out how many of each possible element appears in the list. You can use foreach to write a method that counts items ( by storing them in a dictionary I expect ), or you can just sort the list and then step through it ( counting then becomes trivial )
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello,
You may use the Array concept for the same as .Net provides FindAll() method for it as well.
I would suggest you to go through the given links of MSDN.
http://msdn.microsoft.com/en-us/library/1kkxfxdd.aspx
http://blogs.msdn.com/rfarber/archive/2006/07/28/681578.aspx
I believe this should help you.
Regards,
Allen
Allen Smith
ComponentOne LLC
www.componentone.com
|
|
|
|
|
is there a way to display data into listview if the data is located in different tables in ms access? thanks
|
|
|
|
|
You can get the data from different location formulate in a string the way you want and then add the string...
Good luck
|
|
|
|
|
First, please read the post at the top of hte forum on how to ask questions. Everyone here wants help in VB.NET.
Yes, you need to write the SQL that selects the data you want to display from across the tables, by doing joins betwen the tables. If the tables are unrelated, then probably not.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I am fairly new to VB.net and have been working with regular expressions recently. I was wondering how someone would call a static Regex from a compiled .DLL in an application? I have tried multiple ways to make the regex available from the .DLL, but no luck.
Any information would help.
|
|
|
|
|
Not sure what you mean, how is it in a dll ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi
I am in the process of adding video capture functionallity with the use of the DirectShow API. My program has been written in VB.NET, but due to compatibility issues I have been writing code in C++ so that I can fully access the directshow api.
But I seem to have hit bit of a brickwall in attempting to integrate the code.
I thought it was possible to be able add the c++ project into the VB.NET project, and be able to make function calls from the VB.NET GUI interface with the C++ code. Is this possible?
Another option that I am now considering is exporting the c++ code as a DLL file and from there I can access the c++ as a library file?
Although I would prefer my first suggestion if this is possible?
Any suggestions would be greatly appreciated
Cheers
boyindie
|
|
|
|
|
Yes, you use pinvoke for that, and yes, your C++ code needs to be in a dll. Or, you can make your code C++/CLI, then you can call it directly, but it still needs to be a dll
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I am working with VB.Net 2005 looking at an Access 2003 database. When I run my Crystal Report (version 10.0.5.1279) I get a Database Login screen even though I don’t have passwords set at all in this datatbase. Can anyone tell me of a way to stop this from coming up?
Thanks in advance for all of you help.
|
|
|
|
|
I've had a similar issue and was only able to get around it with a rather complicated work around. It has to do with the database you designed the report with no longer being located in the same file structure as it was during design time...which is NEVER once you've deployed it and the report is being run on your client's machine.
I got past the issue by including an access database that contained the same table and field structures as I used during design of my crystal report. Then, before I set the report documents datasource or the crystal viewer's ReportSource property, I do the following:
'My schema database has been downloaded to the CurrentUserApplicationData folder via ClickOnce publish settings
Dim strSchemaPath As String = My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData & System.IO.Path.DirectorySeparatorChar & "SchemaDB.mdb"
'This will set the login info to the schema DB, even though it has no passwords set, so the login screen will not display
cdReportDocument.DataSourceConnections.Item(0).SetConnection(strSchemaPath, "", False)
This workaround seems very silly, and requires the user to download a good sized file when they really shouldn't have to. But I've posted this question in several forums and no one has been able to help me with a better fix. If you find anything better please let me know.
|
|
|
|
|
I need to call NetAPI32 to get domain info on legacy workstations (IE: Win98, etc - DirectoryServices is not avail in 98).
I have the following code. The call to DsGetDcNameAWin5 doesn't error off, but the values are 0. I've tried changing the function declare to (using a pointer) as the last param with no success also:
Private Declare Function DsGetDcNameAWin5 Lib "netapi32.dll" Alias "DsGetDcNameA" (ByVal ComputerName As String, ByVal DomainName As String, ByRef DomainGuid As GUID, ByVal SiteName As String, ByVal Flags As Integer, ByRef lpDomainControllerInfo As IntPtr) As Integer
Could someone please show how to properly call and then extract the data from this .dll?
Sample code:
Private Const NO_ERROR As Short = 0
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef pTo As Integer, ByRef uFrom As Integer, ByVal lSize As Integer)
Private Declare Function lstrlenA Lib "kernel32" (ByVal lpString As Integer) As Integer
Private Declare Function DsGetDcNameAWin5 Lib "netapi32.dll" Alias "DsGetDcNameA" (ByVal ComputerName As String, ByVal DomainName As String, ByRef DomainGuid As GUID, ByVal SiteName As String, ByVal Flags As Integer, ByRef lpDomainControllerInfo As Integer) As Integer
Private Structure GUID
Dim Data1 As Integer
Dim Data2 As Short
Dim Data3 As Short
<vbfixedarray(7)> Dim Data4() As Byte
Public Sub Initialize()
ReDim Data4(7)
End Sub
End Structure
Private Structure DOMAIN_CONTROLLER_INFO
Dim DomainControllerName As Integer
Dim DomainControllerAddress As Integer
Dim DomainControllerAddressType As Integer
Dim DomainGuid As GUID
Dim DomainName As Integer
Dim DnsForestName As Integer
Dim Flags As Integer
Dim DcSiteName As Integer
Dim ClientSiteName As Integer
Public Sub Initialize()
DomainGuid.Initialize()
End Sub
End Structure
Private Function SetDcNameA(Optional ByVal strDomain As String = vbNullString, Optional ByVal strComputer As String = vbNullString) As Boolean
Dim lpBuffer As Integer
Dim dci As DOMAIN_CONTROLLER_INFO
dci.DomainGuid.Initialize()
m_LastError = DsGetDcNameAWin5(strComputer, strDomain, dci.DomainGuid, vbNullString, m_Flags, lpBuffer)
If m_LastError <> NO_ERROR Then
GoTo ErrorHandler
End If
' Recover structure into one we can deal with in VB
'Call CopyMemory(dci, lpBuffer, Len(dci)) 'Doesn't compile
' Transfer contents to member structure.
m_DCI.DomainControllerName = PointerToStringA(dci.DomainControllerName)
m_DCI.DomainControllerAddress = PointerToStringA(dci.DomainControllerAddress)
m_DCI.DomainControllerAddressType = dci.DomainControllerAddressType
m_DCI.DomainGuid = dci.DomainGuid
m_DCI.DomainName = PointerToStringA(dci.DomainName)
End Sub
Private Function PointerToStringA(ByVal lpStringA As Integer) As String
Dim Buffer() As Byte
Dim nLen As Integer
On Error GoTo ErrorHandler
If CBool(lpStringA) Then
nLen = lstrlenA(lpStringA)
If CBool(nLen) Then
ReDim Buffer((nLen - 1))
CopyMemory(Buffer(0), lpStringA, nLen)
'Not sure if this line is correct as well.
PointerToStringA = StrConv(System.Text.UnicodeEncoding.Unicode.GetString(Buffer), VbStrConv.None)
End If
End If
Exit Function
ErrorHandler:
PointerToStringA = ""
End Function
|
|
|
|
|
I am currently studying computer in a local university in my country.
I am using Visual Basic 2008 to develop a program for a Windows computer(desktop) which only have one numeric keypad and does not have any standard keyboard.
I hope that when my program is running but Windows focus on other application, or when my program is running in inactive status, if the user press the '+' button (or other button set by me) for three times on the keypad with fast, Windows will switch to my program immediately.
How can I do that?
|
|
|
|
|
Set a keyboard hook[^] watching for the + key. When it is pressed start a timer. If the + key is pressed two more times before the timer event fires, show your form. Otherwise, do nothing.
|
|
|
|
|
How can I set my simple VB.NET program to start in minimized mode?
My program consist of one form.
|
|
|
|
|
Isn't there an initial state property for the form in the designer ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
Set the window state property of the form to minimized
Regards
Azeem
|
|
|
|
|
i am adding a tool in the existing menu bar
and i can view it in the design mode but unable
to view in runtime.i am using third party
controller (Infragistics).
pls help.
modified on Tuesday, June 24, 2008 10:24 AM
|
|
|
|
|
Not a lot to go on, is there? I suspect a licence issue, but the best bet is to contact Infragistics.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
i can view all other existing infragistic control but
the control i added is invisible.the project is of
another developer i just modifying and upgrading little.
when i first try to open in design view it was giving lots of errors.
but i downloaded infragistic.since then i can view all control except
the control i m adding.
thanx 4 replying
|
|
|
|
|
hey all,
i have an application developed in vb6 and i have to migrate it to vb.net
is there any free tool to help me doing that?
10x a lot
|
|
|
|
|
Visual Studio tries, but I don't know of any better tools. VB6 -> VB.NET is two different languages, some rewrite will always be needed.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|