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
ADVERTISEMENT
Apr 26, 2011
I'm migrating VB code to VB.Net and I can not figure out why my files are not copying to there new folder. Here is the old VB code below:
Public Sub FileTransferDoneImage(ByVal FilePath As String)
OnlyFileName = GetFileName 'Get only filename
OnlyPath = GetPathOnly(FilePath) 'Getting only the path
[code]....
The message box shows the correct path/file, but the files are not copying?
View 2 Replies
Feb 21, 2011
I'm working on some legacy VB5/VB6 code and need to convert a ".bas" file to vb.net. i found several options
Compile the .bas file into a com dll and then reference and use it in my project. (For this I guess I would need vb5 or vb6 which I don't have at my disposal) Copy and paste the contents of the file in to a new module in vb.net and then try solving the errors one by one.The contents of the .bas file reference a particular dll. The .bas file has mostly declarations consts, types, sub's and functions.
What would be the most elegant way of redoing this in vb.net. Is it as simple as option 2.EDIT
I used VS2008 express and ran the code through the upgrade wizard it did the necessary conversion. and the .bas file was converted to .vb. I took that file and decided to rewrite other parts of the code, including some redoing of the converted .vb file. Other questions related to this one are here.
View 3 Replies
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
Oct 13, 2010
I am doing data migration two database in MS SQL 2005. The records are more than 200000 nearly 300000. I need to query from source database using joins and insert 2 or 3 tables in destination databse. Which way is the best way to do so? I am trying to write a program with VB.NET. If you have sample,
View 1 Replies
Aug 1, 2009
I currently have a list of words in a text file sorted in to alphabetical order and put into lower case, but I would like to be able to also display the line numbers on which these words are associated with.. but only one instance of.
For example,
"This is a random text
file that I
have just made
up this second"
[Code].....
As you can see above, I would like to show that "this" for example appears on line 1 and 4. Hopefully tabbed so that it keeps a nice look to it.
View 1 Replies
May 29, 2009
i want to keep only the last 10 numbers in a List.
The list is declared as: Dim LastPlayed As New List(Of Integer)
I then Add several Items, each time checking LastPlayed.Count is no bigger than 10.
If it is, i only want to keep the 10 most recent numbers.
View 7 Replies
Nov 1, 2010
VS2010
VB
I would like to be able to add every combination of a list of numbers to determine which combinations equal a specific result.
Simple Example:
List: 2, 4, 6
Result: 10
How many and which combinations of numbers result in the number 10? The correct anwser is only one which is 4 + 6 = 10. The example is simple but the actual list may contain as many as 10 - 15 decimal numbers.
I have thought of the following as a possible way of checking each combination by using binary:
- There are 3 total number so the possible combinations would be:
123 - Three numbers
000 - Add no numbers
001 - Add the last number
[Code].....
However, I don't know how to actually match up the bitwise bits to the numbers in the array to actually add. Example:
101 - I should check if 2 + 6 != 10 per the example above so this wouldn't satisfy the result... does this make sense? The answer would be 4 + 6 = 10.
how to check and add all combinations from a list of numbers to determine if the result is a specific number?
View 2 Replies
Sep 28, 2010
Is there a way of adding the values 1-15 to an asp dropdownlist without having to do each one individually... I currently have:
[Code]...
View 6 Replies
Feb 16, 2012
I am working on a project where i need to get the average of 6 numbers i enter in a ListBox. There is one ListBox, one button to get the average, and one label where the average is displayed. i need to use an array and I am using the Visual Basics Programming but i dont think it is that big of a difference.
View 5 Replies
Jul 16, 2010
I'm trying to generate a text file that contains a list of numbers.This is what i have :
Dim startint As Integer
Dim endint As Integer
startint = TextBox1.Text
[code]....
View 3 Replies
Jan 28, 2011
Can I have a List containing one string and two numbers? Or I can only have one type of element?
View 3 Replies
May 4, 2010
Need to calculate Average Plan Duration for the 3 Shipment TypesSo far i haveQuote:
'CALCULATING AVERAGE DURATION FOR STANDARD
Dim iAverage As Integer
Dim iAvgDuration As Integer
[code]....
I uses the information from the list boxes, (lbShipmentDuration) and (lbShipmentMethod) to calcualte the average Duration for each Shipment Type.
View 19 Replies
May 20, 2012
getting random number from list of numbers is getting me sick. i am trying to do it for like 20 days now but every time i do it ends up in a loop wich crashes the my.settings system. does anyone have an idea how to get a random number from a list. then delete that number so it cannot be called again. my system must mark some items with numbers but non ofthe numbers may be used more then 1 time the max items in my system is 90. so from 1 to 90 without getting 2 times the same number heres the code i tryd
[Code]...
View 14 Replies
Mar 31, 2010
I want to make a program like this but not with random numbers ! I want it with A list from ".txt" or "from number 1 to number 999999999"
Public Class Form1
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Timer1.Start()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Timer1.Stop()
[Code] .....
View 8 Replies
Aug 7, 2009
I'm trying to shuffle a Euchre Deck and it works but I feel like I'm cheating. Is there a more concise way to randomize a list of numbers 1 - 24 and have no repeats? ex. 14, 3, 18, 23...
Dim Deck() As String = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24}
Dim A As New Random
Dim B As Integer = A.Next(0, 24)
Deck(B) = "9 of Clubs"
[code]....
View 7 Replies
Sep 21, 2010
Is it possible to store two related numbers in a list and then check them if the are exist in the list?ere is an example of what I did to achieve the above:
Dim CounterConnections, FromN, ToN As Integer
Dim ConnectionsList As New List(Of Integer)
Dim Myrandom As New Random
[code]....
The above code generate two random numbers and store the in a list. I am adding the two numbers to be one so that I can check if they exist in the list.e.g. if the FromN = 7 and ToN = 11 then the list will consist of :
711 and 117
a list to store 11 7 and 7 11 which is capable to be checked later if some some numbers are exists.
View 3 Replies
Mar 16, 2011
Below is a form which produces a graph, the idea is to produce 6 random numbers from a range (0,6) place the numbers in an array then use these numbers to produce columns on the graph, however at the moment it is using the numbers more than once, how can I get it to just use the values once only in the array.
Private Sub btnGraph_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGraph.Click
txtAns.Text = ""
g.Clear(Me.BackColor)
g.DrawLine(Pens.Black, 50, 70, 50, 420)
[Code] .....
View 7 Replies
Dec 8, 2010
Create a GeneratedNumber application that stores in an array with indexes 1 through 100 numbers generated by the index values when Generate is clicked. Generate the number to be stored at each index by summing the index and it's individual digits. For example, 25 should be stored at index 17 because 17+ 1+ 7 = 17 and 4 should be stored at index 2 because 2+ 0 + 2.
Your program should use a FillArray() procedure to generate the nuymbers and DisplayArray() procedure that displays each index and its element in the list box.
[Code]...
View 6 Replies
Nov 30, 2010
how to add together integers from the end of a list array based on certain criteria. example: a list of students assignments and grades, and im trying to add all of the grades from a certain student up based on the student id from the user.
the student table looks like this:
111 H1 09/12/2010 17
111 P1 09/14/2010 42
111 H2 10/02/2010 18
[Code].....
View 2 Replies
Oct 27, 2010
I would like to create a sub menu that list part numbers that are gathered from a xml file. I am having trouble with creating the sub routines for the part numbers menus because it can change.
Private Sub mnuP1Layers_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim BFFile as string
My.Computer.FileSystem.MoveFile(BFFile, "C:ExchangePrintedBFFile")
View 3 Replies
Nov 5, 2009
I am trying to learn about arrays and the for next..loop. This is a noob question but I cant seem to get it to work. I am trying to load an array with 30 numbers that print to a list box.
Dim a(29) As Integer
Dim strVar As String = "{0,-5}{1,5}{2,5){3,5}{4,5}"
Dim x As Integer
[Code].....
For some reason I keep getting errors in the output statement that says "Input string was not in a correct format."
The output should list 1 to 30 in the list box
View 5 Replies
Dec 15, 2007
Im trying to do a lab that will obtain 10 numbers from the user using an InputBox() function, store them internally in a one-dimensional array, and then compute the average of the numbers and sort them in reverse numerical order. The program should control that 10 numbers (no more, no less) are entered, and that the numbers are fully validated as integers.
If the user enters non-numeric data, then an appropriate error message should be shown, and that number should be allowed to be re-entered as a valid number. Then all the numbers should be shown as a list in a 'message box'. So far I can get everything but the message box to show the list of numbers entered.
[Code]...
View 14 Replies
May 17, 2009
how do I sort a list properly so the numbers are truly in order?
BAD GOOD
1 1
10 2
11 3
[code]....
View 6 Replies
May 18, 2010
I have an array of integers (5 x 5). Is it possible for an index to have a a list of numbers?For example, Row3, Column 4 has 10, 4 52,10 Array (3,4) = 10,4,52,10
View 4 Replies
Feb 26, 2011
So I have an assignment dealing with arrays for school but first I will start it off with the simple question as to where I am stuck now. I was wondering what the simplest way is to declare all the numbers in an array without going down the list one by one ( ArrayA(1) = 1, ArrayA(2) = 3 and so on.) I was wondering if the simplest way to do this is just by putting: ArrayA = ArrayA += 1 or what the simplest way to do this is.
View 6 Replies
Oct 19, 2009
I am trying to write some Linq to SQL that will bring me back a list of rows containing a single instance of BaseQuestionIDs but I want the row with the highest version, so, from the following table of data:
Id CreatedDate Version BaseQuestionID
2 2009-10-07 13:47:27.687 1 2
3 2009-10-07 13:49:35.010 1 3
4 2009-10-09 16:03:45.973 1 5
[code]...
I want to return:
Id CreatedDate Version BaseQuestionID
2 2009-10-07 13:47:27.687 1 2
3 2009-10-07 13:49:35.010 1 3
[code]...
I have tried a variety of things, but have not nailed it yet. I am working in vb.net?
View 1 Replies
Feb 7, 2011
I am currently trying to create a program to list a large group of numbers for me. My final goal is to have every 2, 3, 4, ..., and 9 digit number containing only "1" "2" and "3". I thought I would go about this by using the following VB.NET program and then copying it into a text editor, and using find & replace to eliminate all other numbers.
Public Class Form1
Dim Start As Integer = 333333333
Dim Counter As Integer = 333333333
[Code].....
it fails due to the massive amount of processing that needs to take place. However, adding the intervals requires a great deal of time for each number to be displayed without any crashes.
Is there some way (in VB.NEt or another language) to get the number list I want in a short (an hour or less) amount of time?
View 7 Replies
Feb 22, 2012
I'm creating an application that creates a list of 20 ramdomly selected numbers within an array and displaying those numbers in a listbox. I then need to display the duplicate numbers in an adjacent listbox by clicking the find duplicates button. How would I be able to access those 20 numbers in order to find the duplicates?
View 2 Replies
Dec 24, 2011
So I made a program for generating prime numbers in a list box. My initial code had them listed like this:
2
3
5
7
..ect
Now I have them listed in pairs like this :
[Code]...
View 1 Replies