Getting Three Most Common Numbers From File?

Feb 16, 2010

Essentially, whenever my users who are logged in via a global module level variable enter a new form, their activity is "logged" in a textfile with their UserID as the name.txt and every time they visit a page it adds a new line to their log file with a number corresponding to the form they visited. For example, if they select "add a user" it will add the line "1" to their log file. Note: At the moment there is only 1 2 and 3 not 0.

I have got this far and I have got as far as creating an array which has:
Array(0) = NumberOfTimes 0 appears in the log file
Array(1) = NumberOfTimes 1 appears in the log file
etc etc

Therefore the output for this is
Msgbox(Array(0)) shows "0"
MsgBox(Array(1)) shows "4" for example and lets just say
MsgBox(Array(2)) shows "9" and
MsgBox(Array(3)) shows "1"

Therefore, finally (!) my problem is now finding which 3 are the top. I have tried various methods of sorting them but I just get "9, 4, 1, 0" rather than "2, 1, 3, 0". (By the way the end product for this is to show three links on the "welcome form" of the users 3 most visited forms). Here is a pastebin of all the rubbish I have currently tried that hasn't worked! [URL]

View 1 Replies


ADVERTISEMENT

SQL Query To Update The MAX Within A Set Of Common Numbers In A Column?

Jun 11, 2011

I have program in VB.NET 2008 where I want to update the premamt cell value in the tblPrem Access table, where the premno is the maximum (autogenerated as 1,2,3...), but only within a specified set of common numbers in a column (contno) I am currently saving. This contno is from another table (tblMain) linked in this table (tblPrem) where it is the primary key, and just repeatedly generated after the clicking save button. Here is my current code which saves the data but does not do anything on the textbox1 + textbox2, and has an error message "At most one record can be returned by this subquery":

sqlQrySave = "UPDATE tblPrem SET premamt = " & textbox1 & " + " & textbox2 & " WHERE premno=(SELECT MAX(premno) FROM tblPrem GROUP BY contno);"

What I expect to happen is like this:

contno | premno | premamt
1................1.............45
1................2.............45

[Code].....

View 1 Replies

Common .vb File For All Projects?

Apr 17, 2011

In the old VB, there is a .bas file wherein i place all the global constants there and whenever i create a new project i just include that .bas file so that all the constants i placed are automatically added to my project. Is there any way to do this on VS2008? Ill be doing dozens of Class Libraries that that needs to reference global constants.

1. Is there any other way of referencing the global constants rather than making it a shared variable in a class?

2. Also, is there a way to include a .VB file without the copying it on the local project file? My point being is that this .VB file is also being used by other Class LIbraries that i created.

View 4 Replies

Copy The Client Log File To Common Path In Server

Dec 2, 2010

In our project logs files are stored in clients local only . So during any production issues we have to be waiting till they provide us the log file. What is the best way to copy the log file from clients local machine to some common path in one of our servers .

View 2 Replies

Common Dialog File Multiselect + Explorer Not Showing Files Selected?

Jan 30, 2007

i have a vb script that is imbeded in an html page (hta). when i use the common dialog flags = cdlOFNAllowMultiselect the file list is present in the filename object and are separated by a space. however when i use dialog flags = cdlOFNAllowMultiselect Or cdlOFNExplorer the files that i selected on the dialog box, are not present in the filename object. the only thing that's there, is the path to the files. here's the code:

Const cdlOFNAllowMultiselect = 512Const cdlOFNExplorer = 524288Set ObjFSO = CreateObject("UserAccounts.CommonDialog")ObjFSO.Filter = "All Files|*.*"ObjFSO.FilterIndex = 1
ObjFSO.InitialDir = "c:" ObjFSO.Flags = cdlOFNAllowMultiselect or cdlOFNExplorerinitFSO = ObjFSO.ShowOpen selected_files = ObjFso.FileName msgbox selected_files

how can i get the files names?

View 2 Replies

Could Not Find File 'Microsoft.Windows.Common-Controls Version=6.0.0.0, Culture=*, PublicKeyToken=6595b64144ccf1df, ProcessorArchitecture=*, Type=win32'._[projectname]

Nov 22, 2010

I am getting the following error when i try to publish my application with the checkbox for ClickOnce Security On. Could not find file 'Microsoft.Windows.Common-Controls, Version=6.0.0.0, Culture=*, PublicKeyToken=6595b64144ccf1df, ProcessorArchitecture=*, _ Type=win32'. [projectname ]

[Code]...

View 6 Replies

Compiling VB Project In VS2005: Error With "Microsoft.Common.Targets" File

Jun 17, 2008

I am compiling a VB Project in VS2005 with SP1. This is the error that I am getting when I build this project.

12>C:WINDOWSMicrosoft.NETFrameworkv2.0.50727Microsoft.Common.targets(802,9): error MSB3108: Error executing the ResolveNonMSBuildProjectOutput task. An error occurred while parsing EntityName. Line 1, position 115.Microsoft.Common.targets is a file present in WINDOWS folder and used internally by VS2005 while building the projects. I am not able to get any clue why this error has come.

View 4 Replies

Removing Numbers From File Name?

Jan 23, 2012

Lets say I have 500 pictures, they are named by date and lot code as well as what they are.

Here is an example:
20110406_174805_T0A_V1113465_F.tif

This configuration is not able to be reconfigured so I am not able to use a left or right string to get my information. What I would like to do is remove all of the numbers from it and then up until the first letter (if possible). Then I could extract the next 3 characters to get what I need. I then need this put into a variable for comparison to another string.

View 6 Replies

How To Use Common Variables

Jan 12, 2012

I am new to .net and I usually had a common file which was having information of username,server,password,IPS and fixed integers in php and asp classic which i used to include in all files so that i could use them in any page. Since I have come to know that .net has no include function. how i can do it in asp.net?

View 3 Replies

Read Numbers From Text File?

Dec 7, 2011

I got a text file, which looks like this[code]...

View 8 Replies

Reading Numbers From File Into A String?

May 1, 2012

i have a number in this format: 123 and I want a select statement such as below for comparsion so i dont have as many if statements:

Select case numbers(i)
case is = "123"
case is = "234"

example but in real scenario numbers are random.

Heres my code in which all select cases dont get fired:

Public Function UserAdd() As String
On Error GoTo Errorhandler
Dim personcount As Integer

[Code]....

But the case is statements above dont fire when I know that number is correct above

View 9 Replies

Saving Five Labels With Numbers In File

Nov 4, 2009

I've made a thing that has several labels that gives a number on each label. And if you press a button next to the label it adds one to the number. But enough about that. I wanna be able to save the numbers in a file. And when I press open and select the file I've saved in the numbers should appear on the same place they were before. To make this easy, lets say I have 5 labels with numbers that's needed to be saved.

View 12 Replies

Vb6 Migration - List The Used File-numbers In VB 3.5?

Nov 23, 2011

how to enumerate the used file-numbers [as in FileOpen(filenum, ...)] in Visual Basic .NET 3.5 (VS2008)?

The situation is: I'm doing "a quick port" (just to bring it up a supported architecture) of an old VB6 WinForms application (it's "just a tool" really, not a full-on app) to VB.NET using Visual Studio 2008's automatic translator, over the .NET 3.5 framework. The existing code stores "records" in parallel arrays, the index of which is the output-file-number, and output-files are opened and closed "ad hoc"... so I can't "just" use FreeFile (I could, but it'd basically be a rewrite, which we won't get paid for).

After translating I've got an "invalid filename or number" error upon FileOpen'ing filenum=350 for Ouput... I know the filename is valid, and doesn't already exist. I tried (just for debugging) setting filenum=FreeFile and that worked (i.e. the file was opened)... so I figure that filenum=350 is already open, but how to tell BY WHAT? A listing of the used filenums -> names would give a huge leg-up.I suspect this just isn't possible, but I've got to ask anyway, because it was save ever-so-much time, effort, and thought if it is possible, so here we are.

View 1 Replies

Create Another Six Textboxes / Same Time Allocate These Numbers In Ascending / Descending Numbers.

Jun 21, 2010

I have six textboxes, and upon button press it randomly generates six numbers, one in eact text box e.g. [43] [85] [93] [1] [0] [17]..i create another six textboxes and at the same time allocate these numbers in ascending/descending numbers.I am not looking for any codes whatsoever, as i love the challenge of VB.Net.

View 2 Replies

Project - Average Numbers, Maximum And Minimum Values, Range Of The Numbers

Apr 7, 2009

Im trying to write a program that will do:

1.The average of the four numbers. This answer will be placed into a text box reserved for that value. This text box cannot be changed by the user.

2.The maximum and minimum values. These will be denoted by changing the color of the largest number green and the smallest number red.

3.The range of the numbers. The range is defined as the difference between the largest and smallest numbers. The range will be placed into its own text box, labeled as such. This text box cannot be changed by the user."

Im using visual studio 2008 and it has to be written in VB

View 35 Replies

Use .next (random Numbers) To Randomly Select Something From A List Of Numbers But It Can't Repeat The Number?

Aug 16, 2009

So how would I use .next (random numbers) to randomly select something from a list of numbers but it can't repeat the number?I could do:

dim num as integer
dim r as new random
num = r.next(1,5)
if num = 1 then
elseif num = 2 then
etc.

That wouldn't work because it would repeat.If I donwload someone's game can I disect it in VS? :0 I tried going to open project, then I went to the folder and clicked open. It brought me inside of the folder so I tried to open the game but there is no form1 there. It says the games name then .exe in the explorer-like thing in the top right?Also, how would I have a value or something in a label and access it from a button.

Example:This is in a label.

Dim number as Integer
number = 0

Then in the button do

Label.number = 0

How would I do something like that? I want to use that a lot as I did in a different language.

View 6 Replies

User To Input Numbers From An Inputbox And It Displays The Total Numbers Entered?

Mar 18, 2011

I have a program that allows a user to input numbers from an inputbox and it displays the Total numbers entered, the sum of the numbers entered, and the average of the numbers entered. What I can not seem to find it how to have it display the largest number entered. The code I have so far is,

[Code]...

View 11 Replies

VS 2008 - Add Two Excel Sheets With Numbers And The Equal (similar) Numbers To Save Once

Mar 28, 2010

how can i add two excel sheets with numbers and the equal (similar)numbers to save once

View 1 Replies

Add Some Common Details In More Than Two Tables

Oct 27, 2010

I need to add some common details in more than two tables. [code]So i have stored the Department (from drop down list box) and assigned it to Dept.So i guess dept would have Csc if i choose csc and commerce if i hoose commerce.When I checked with breakpoint it s workin. Datas are added perfectly. But they are not visible in that respective table

View 2 Replies

Common Event For Like Controls?

Aug 28, 2011

Is it possible to set up a common event handler for a group of like controls like buttons or text boxes so a single event handler is called regardless of which of the controls is clicked, changed, etc.In my PrinterDialog study project I have 5 text boxes named TB1, TB2, TB3, TB4 and TB5 in a text box array called TBs so they can be accessed with TBs(0), TBs(1), etc.My question is if I can set up a single click event that responds when any of the 5 text boxes are clicked to avoid duplicate code n 5 different click events.

View 1 Replies

Dbtype Of Common Dbparameter

Aug 9, 2009

if i miss to set dbtype of my parameters (common.dbparameter) it works fine again?Is necessary to explain dbtype or not?

View 1 Replies

Get Common Images For Buttons?

May 25, 2009

I know it is not vb question but I was wondering if there is any place to get the common images for buttons (like save, clear, find, new , delete etc...)

View 2 Replies

Get The Data 'less Common As Possible' From A Collection?

May 15, 2011

Starting from a table like this:

| Code | Year |
---------------
| A01 | 2001 |
| A01 | 2002 |
| B01 | 2002 |
| C01 | 2003 |

I have to arrive to this:

| Code | Year |
---------------
| A01 | 2001 |
| B01 | 2002 |
| C01 | 2003 |

I have to group the first column (Code) and from the second (Year) I have to get the data 'less common as possible' compared to all the other records. I try to explain this with the example: for the code 'A01' I have 2 years: '2001' and '2002'. I have to take '2001' because it's the one that not recurs in the other records. In the case that there aren't available values 'Year' that not recurs in the other records, it's good to take whatever value.

The data are in the form of array in memory and to interact with them I'm useng some LINQ queries.

View 4 Replies

List Of Most Common Errors?

Nov 2, 2009

When I was learning QBasic I found a list of most common errors and it told me whether my errors were syntax errors or logic errors. Where I can find a similar list for VB 2008 Express Edition?

View 7 Replies

One Common Navigation For All Forms?

Feb 15, 2012

i made an application using VB.NET 2010. i have 5 forms. i want to know how to make one common navigation (like in a webpage) for this application. Is it possible to have the menu and header static and loads each form in one dynamic container. I hope my questing is clear :P just to make it more cleared, it is more like having a templates in php coding where we can load other page in a particular area without having to reload the entire page with each links.

View 2 Replies

Use A Common _ViewStart In Areas?

Nov 5, 2010

In my "root" Views folder, I have a _ViewStart with the following code:

@Code
Layout = "~/Views/Shared/_Layout.vbhtml"
End COde

[code].....

View 3 Replies

Create An Application That Reads Numbers From A File?

Apr 3, 2011

I need to create an application that reads numbers from a file. it then should display the total of the numbers, display the average of the numbers, display the highest number in the file and display the lowest number in the file. We are using visual basic 2008. I am new to this and stuck . How do I begin. I included the number set that we are supposed to read from.

Attached File(s) NumberSet.txt (990bytes)Number of downloads: 80

View 14 Replies

How To Get Numbers From A Text File And Place Them Into A Listbox

Feb 25, 2011

For this code, its saying that "File not declared". My textbook isn't specific at times. I was wondering how do I declare "File" or what else will I need to declare.[code]

View 7 Replies

Loop SWF File Using Specific Frame Numbers?

May 27, 2010

how to loop an SWF file using specific frame numbers. I don't want the SWF file to play thoroughly. I know that frame 1 in Flash is 0 in VB, frame 2 in Flash is 1 in VB, etc.

View 5 Replies

Magic Numbers - File Header And Footer

Feb 12, 2011

For my project, I need to develop an app, which will have MS-SQL db with 4 tables
a>FileHeader
b>FileFooter
c>Extension
d>Detail about the file.
This is all to do with the Magic Numbers, or File header and footer, found in all files. The first 4-byte and last 4-bytes.

Example:
Suppose a word DOC file when read using this app should return and match the values
D0 CF 11 E0
So, how can I read the files using vb.net, fileIO, FileStream/StreamClass/FileReader? I just need to open the file and read the first 4 and last 4 bytes of any given file. And then it should connect back to the SQL database and lookup for the matching values from the tables as I had mentioned. And return a match found or not found.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved