Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If there is only one file then the loop will execute once and append the single file.

ddanbe commented: Simple enough! +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I am not a fan of special case programming. It clutters up the code. Why not create an empty file outside the loop and then just append all of the files? That way you don't need separate code for "first file" and "all of the other files".

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

silly UI bugs?

The only bugs I would classify as "silly" are the ones that the developer should have caught himself before passing the system on to the testers, in other words, the ones that the developer should feel silly for not having spotted early on. What, exactly, do you consider to be a "silly" bug?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The trouble with posting

sqlCommand = "INSERT INTO Personss (names, contactnumero, emailadds, pages, projects, agents, sources, months, days, years, times, agents1, transactions, months1, days1, years1, times1, agents2, transactions1, months2, days2, years2, times2, agents3, months3, days3, years3, remarks, months4, days4, years5, remarks1, months5, days5, years5, remarks2 ) VALUES ('" & txtbname.Text & "', '" & txtContact.Text & "', '" & txtEmail.Text & "','" & txtWeb.Text & "', '" & ComboBox2.Text & "', '" & ComboBox1.Text & "', '" & ComboBox44.Text & "', '" & cmbMonth.Text & "', '" & cmbDay.Text & "', '" & cmbYear.Text & "', '" & cmbYearTime.Text & "', '" & Combobox4.Text & "' , '" & ComboBox10.Text & "' , '" & cmbMonth1.Text & "' , '" & cmbDay1.Text & "' , '" & cmbYear1.Text & "' , '" & cmbYearTime2.Text & "' , '" & ComboBox5.Text & "' , '" & ComboBox11.Text & "' , '" & cmbMonth2.Text & "' , '" & cmbDay2.Text & "' , '" & cmbYear2.Text & "', '" & cmbYearTime3.Text & "', '" & cmbMonth3.Text & "', '" & cmbDay3.Text & "', '" & cmbYear3.Text & "', '" & TextBox2.Text & "', '" & cmbMonth4.Text & "', '" & cmbDay4.Text & "', '" & cmbYear4.Text & "', '" & TextBox3.Text & "', '" & cmbMonth5.Text & "', '" & cmdDay5.Text & "','" & cmbYear5.Text & "' , '" & TextBox4.Text & "')"

and asking "where is the syntax error" is that without knowing the values of all of the …

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Your biggest problem is that you've already decided how you want to do it, but how you want to do it is wrong. Why are you so wedded to the idea of discrete variables? It would also help to know if you are using SQLClient or OLEDB.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
D1*X584635*test.one*12643820000000000?*D2*65496321476=2416317950000000000*(Y@12345)*Date:*05*April*2016*Time:*17*01*32
  1. D1
  2. X584635
  3. test.one
  4. 12643820000000000?
  5. D2
  6. 65496321476=2416317950000000000
  7. (Y@12345)
  8. Date:
  9. 05
  10. April
  11. 2016
  12. Time:
  13. 17
  14. 01
  15. 32
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Clear as mud. Why do you need to put the values into discrete variables when they are already in discrete array elements? I also notice that you say

Each line will produce/has 13 fields so I want to get these as a variable.

but your sample line has 15 fields.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm not clear on what you want. Perhaps you can post a sample input file with all of the possible variants and an example of how that data will look when displayed after filtering. That will probably be clearer than an explnation. In the mean time you can simplify your code considerably. If you use a ListView in Details mode (with 15 columns) you can display your file as follows:

Dim file() As String = System.IO.File.ReadAllLines("D:\temp\test.txt")

For Each line As String In file
    Dim fields() As String = line.Split("*")
    lvwFields.Items.Add(New ListViewItem(fields))
Next

or even simpler

For Each line As String In file
    lvwFields.Items.Add(New ListViewItem(line.Split("*")))
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Based on what you've said the command would be something like

SELECT * FROM settlement WHERE settlement = 0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Most Dells these days do come with a diagnostic partition that yu can select if you tap-a-tap-a on the F12 key while powering up. I think POWER+D just boots into a special (undocumented) video diagnostic. Can't say if HP has something similar.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I have repeated problems with Dell Hardware Support in trying to convince them that a problem is hardware (warranty) rather than software (not covered). I have found that the easies way is to boot into Linux and demonstrate that the problem still exists. Download a Linux (I find kubuntu the friendliest) LiveCD and burn a DVD. Bott into the DVD (select try instead of install) and see if you have the same problem. If you do then you know the problem is with the keyboard.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you want to use the if at the end then use

if (x == X || y == Y) break;
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Have you actually made the site or are you just considering it? Personally, I would refuse. However, if you are trying to build a portfolio at the start of a career I can see why you might be considering it.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If your starting values guarantee at least one execution then use the while as in

while (x != X && y != Y) {
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Your choice will depend on whether of not you want the loop to execute at the least once or zero times. If you want to execute at the least zero times then use

while (x != X || y != Y) {
    .
    .
    .
}

If you want to ensure at least one execution then use

while (1) {
    .
    .
    .
    if (x == X && y == Y) break;
}

However, I'm basing that on your most recent post which says

Because I want to breal (sic) when both conditions apply , when x and y are equal to X ,Y ,not one of them.

Your original post stated

while( x!=X && y!= Y )

which means execute while neither of the conditions is true. If you can restate what you want to do then I can show you the proper statement(s). Ideally you should state it as

I want to execute the loop (at least once/at least zero times) while the following conditions are true...

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In the one case you want to continue if x is not equal to X and y is not equal to Y. You have two conditionals that must both be true to continue. If either conditional is false then you do not execute the loop. In other words if condition A is false or if condition B is false then you break. Your conditionals become

while (x != X && y != Y)

and the equivalent at the bottom is

if (!(x != X && y != Y))

which becomes (once you simplify)

if (x == X || y == Y) break;
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You get different results for two reasons. For one thing, one example has the test at the top of the loop and the other has the test at the bottom (guaranteeing at least one loop execution). Also, translating while (A and B) to the (effective) opposite (in one case you want to continue if the conditional is true, in the other you want to exit) you would get if (not A or not B).

If I run the following script (vbScript is not case sensitive so I'm using xx, yy for X and Y).

for x = 0 to 1
    for xx = 0 to 1
        for y = 0 to 1
            for yy = 0 to 1
                top = x <> xx and y <> yy
                bot = x =  xx and y =  yy
                Wscript.Echo x,xx,y,xx, Left(cstr(top),1), Left(cstr(bot),1)
            next
        next
    next
next

You'll see the results.

0 0 0 0 F T
0 0 0 0 F F
0 0 1 0 F F
0 0 1 0 F T
0 1 0 1 F F
0 1 0 1 T F
0 1 1 1 T F
0 1 1 1 F F
1 0 0 0 F F
1 0 0 0 T F
1 0 1 0 T F
1 0 1 0 F F
1 1 0 1 F T
1 1 0 1 F F
1 1 1 1 F F
1 1 1 1 F T

Column 5 is the …

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You could try a Finally clause which is executed whether or not an error occurs.

Try
    con.Open
    .
    .
    'don't do the con.Close here
Catch ex As Exception
    MsgBox(ex.Message)
    'don't do the con.Close here either
Finally
    If con.State = ConnectionState.Open Then
        con.Close()
    End If
End Try
Santanu.Das commented: Good habit to close a connection object at the end of a proceedure/function. +7
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's never a good idea to use spaces in field names. If you do then you have to use delimiters around the field name. If possible you should rename the field and code something like

sql = "select * from material where IDDOS ='" & TextBox10.Text & "' AND MATERIAL_ACEPTABLE = '" & TextBox14.Text & "'"

Access may be the same as MS-SQL in which case you could code

sql = "select * from material where IDDOS ='" & TextBox10.Text & "' AND [MATERIAL ACEPTABLE] = '" & TextBox14.Text & "'"

If that doesn't work you'll have to look up the correct delmiter for Access.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

OK. Note that I set certain flags to the opposite of yours so that I would see the progress of the spawned task.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

How about using a timer which periodically tests for the existence of the ffmpeg process? For example

Public Class Form1

    Private proc1 As New Process

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        'ffmpeg -y -i d:\test.flv -vcodec copy -acodec copy d:\test.mp4

        proc1.StartInfo.FileName = "ffmpeg"
        proc1.StartInfo.Arguments = "-y -i d:\test.flv -vcodec copy -acodec copy d:\test.mp4"
        proc1.StartInfo.UseShellExecute = False
        proc1.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        proc1.StartInfo.RedirectStandardInput = False
        proc1.StartInfo.RedirectStandardOutput = False
        proc1.StartInfo.CreateNoWindow = False
        proc1.Start()

        Timer1.Start()

    End Sub

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick

        If proc1.HasExited Then
            Timer1.Stop()
            MsgBox("done")
        End If

    End Sub

End Class

Appears to do the trick. Just replace MsgBox with a call to your cleanup function.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You said you were using BackgroundWork but it looks to me that you are spawning a separate process. If you actually do it with a BackGroundWorker then you can tell when it is finished by the RunWorkerCompleted event.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The point is not to do all the work for them but to help them learn to do it themselves.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Can anybody give me a solution to do this?

Sounds like homework and nobody is going to do it for you. However, if you show us what you have so far we couuld offer help. What parts are you having problems with? Do you have your algorithm (pseudo-code) written out?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

This is not the case though

It's not going to help to describe what it doesn't do. You'll have to provide more examples to show what it does do.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My (former) boss never understood the concept of "technical debt".

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It would appear the code doesn't sort at all. Can you please explain what you mean by

But then it gets a bit messy as it can sort out numerous array based on the original.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you need to save the positions of the controls from run to run then you can add a Settings variable. Name it ControlLocations and make it of type System.Collections.Specialized.StringCollection with an initial value of 0 (zero). Each entry in the collections consists of the control name, the control x position and the control y position. The fields are separated by !. Add the following to the form load event handler

For Each Control As Control In Me.Controls
    For Each item In My.Settings.ControlLocations
        If Split(item, "!")(0) = Control.Name Then
            Control.Location = New Point(Split(item, "!")(1), Split(item, "!")(2))
        End If
    Next
Next

and you'll have to change the endDrag handler to save the new positions

indrag = False
My.Settings.ControlLocations.Clear()

For Each Control As Control In Me.Controls
    My.Settings.ControlLocations.Add(Control.Name & "!" & Control.Location.X & "!" & Control.Location.Y)
Next

My.Settings.Save()
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's certainly possible. Create a form and put a few controls of any type on it. Then add the following code.

Public Class Form1

    Dim indrag As Boolean   'true while dragging control
    Dim startX As Integer   'x powition at drag start
    Dim startY As Integer   'y position at drag start

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'assign handlers for drag and drop to all controls

        For Each Control As Control In Me.Controls
            AddHandler Control.MouseDown, AddressOf startDrag
            AddHandler Control.MouseMove, AddressOf Dragging
            AddHandler Control.MouseUp, AddressOf endDrag
        Next

    End Sub

    Private Sub startDrag(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)

        'Mouse down - set drag active and save start position

        indrag = True
        startX = e.X
        startY = e.Y

    End Sub

    Private Sub Dragging(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)

        'move control to new position

        If indrag Then
            sender.Location = New Point(sender.Location.X + e.X - startX, sender.Location.Y + e.Y - startY)
            Me.Refresh()
        End If

    End Sub

    Private Sub endDrag(ByVal sender As System.Object, ByVal e As System.EventArgs)

        'Mouse up - set drag inactive

        indrag = False

    End Sub

End Class

This will allow you to reposition any control. If you only want to move specific controls then do AddHandler only for those controls.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

There are a few hotkeys that might help if you are stuck (^ = CTRL).

^Q quote
^I italic
^O ordered list
^H heading
^K inline code
^L enter link
^B bold
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Yes. The <> 0 means greater to or less than (in other words, not equal to) zero. When you enable the proxy does the value of the registry item change to a non-zero value?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can get the value as an integer by

Dim key As String = "HKEY_CURRENT_USER\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"
Dim proxyEnabled As Long = My.Computer.Registry.GetValue(key, "ProxyEnable", Nothing)

If proxyEnabled <> 0 Then
    MsgBox("Proxy server is enabled. Your privacy is at risk!")
End If
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm thinking thal last_insert_id() doesn't get set until you actually execute the query so how about trying

$stmt = $this->db->prepare("INSERT INTO product_master(reg_id,category_id,sub_cat_id,product_name)      VALUES(:reg_id,:category_id,:sub_cat_id,:product_name)");

$stmt->execute(array(':reg_id'=>$productDetails['registration_id'],
':category_id'=>$productDetails['catagory_id'],
':sub_cat_id'=>$productDetails['sub_cat_id'],
':product_name'=>$productDetails['product_name']));

$query=$this->db->prepare("INSERT INTO gy_product_detail(product_id,product_detail,"
    . "product_image_back,product_image_left,product_image_name,product_image_right,"
    . "product_rate,product_discount) VALUES (last_insert_id(),:product_details,"
    . ":product_image1,:product_image2,:product_image3,:product_image4,"
    . ":rate,:discount");

$query->execute(array(
':product_details'=>$productDetails['product_details'],
':product_image1'=>$productDetails['image1']['name'],
':product_image2'=>$productDetails['image2']['name'],
':product_image3'=>$productDetails['image3']['name'],
':product_image4'=>$productDetails['image4']['name'],
':rate'=>$productDetails['product_cost'],
':discount'=>$productDetails['product_discount']));
shany0786 commented: this seems not working don't know where i am wrong +1
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If the name you are using for the new link is already in use as a file name then mklink cannot create the junction. For example, in D:\temp I have a file named test.avi. This is what happens when I run mklink:

D:\temp>mklink /j test.avi d:\shared
Cannot create a file when that file already exists.

In typical Micosoft fashion, the error message is misleading. It should say

Cannot create link because a file with that name already exists.
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Entering that command won't do anything because you haven't specified the link name or the target name. The actual format is

mklink /j link target

Make sure that you use double quotes around link and target ig either or both contain spaces. I just created a junction and the command worked properly. I typed

D:\temp>mklink /j d:\temp\splunge d:\shared

And the result was (not a complete listing)

D:\temp>dir /p
Volume in drive D is Data
Volume Serial Number is E831-ED3D

Directory of D:\temp

2015-12-10  01:04    <DIR>          .
2015-12-10  01:04    <DIR>          ..
2015-10-02  21:18    <DIR>          bob
2015-10-01  12:13    <DIR>          BtSync
2015-09-30  20:44    <DIR>          Source
2015-12-10  01:04    <JUNCTION>     splunge [d:\shared]
2014-06-12  16:44               615 .comments.txt
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What command are you entering?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Well, I know where to go (if and) when I get stuck.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I have a very large computer library that includes

C# 2008 Programmer's Reference
Professional C# 2012 and .NET 4
Beginning Visual C# 2012 Programming
Beginning Oriented Programming with C#
OOP with Microsoft Visual Basic .NET and Microsoft Visual C#.NET Step By Step

Lots of books, but like I said, just a lack of motivation. I start on a project in C# and stumble around, then decide I'd rather just blast it out quickly in VB. Usually when I start to write a program it's because I need it now.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That's why they have Option Strict On. If you set this as a default option (as is advised for beginners) your second example gets flagged as an error and will not compile. I suppose I should have included that in my unsolicited advice from the previous thread. I've never used that option because I am very careful in my implicit casting. I find it obfuscates the code in cases like

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    Dim btn As Button = sender
    .
    .
    .
End Sub

which is a little less typing (but a little sloppier, I admit) than

Dim btn As Button = DirectCast(sender, Button)

I suppose I should have a look at C#. I just can't seem to get motivated. It reminds me too much of java and I really hate java.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I don't see how that is a VB specific problem. Using an inappropriate variable type is something that can be done in just about every language. A way around that would be to disable implicit casting.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I noticed a couple of things.

First of all, you should have posted this in the thread you already statrted for this problem. Other than that:

GrowthRate = 1 * (DailyPercent / 100)

should be

GrowthRate = 1 + (DailyPercent / 100)

But even that won't work because you have the wrong type for DailyPercent. It should be an integer or a double depending on whether or not you allow fractions of a percent. Making it bool essentially means it has the value True or False.

One last suggestion. It is good form to limit the scope of variables. Because Day is used only in the loop it is better not to declare it outside the loop. A better form would be

For Day As Integer = 1 To NumDays
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You are over complicating the problem. You need three things as input

  1. the number of organisms in the original population
  2. the number of days to calculate growth
  3. the percentage growth per day

The user will likely enter the growth rate as a number from 1 to 100. You can convert that to a daily multiplier by dividing that by 100 and adding 1. For example, 20% becomes 1 + 20/100 or 1.2. Each time through the loop you multiply the current population by this number to get the next population size. So the only two statements you need in the loop are

population *= growthRate

and a line to add that result to the listBox.

Now I'm going to offer some unasked for advice. It is no longer encouraged to prefix variables with their type, as in intCount. It is also useless to name a variable with a name that does not indicate its function. Integers are, by definition, counting numbers so intCount is both redundant and uninformative. It is more important to name the variable it indicate its function. Generally, the type can be inferred from the function. NumDays, for example, will likely never be anything but an integer.

My suggestion would be to copy your inputs into local variables such as

population
growthRate
numDays

Of course, with appropriate error checking before converting from string to numeric. Then your loop looks like

For day As Integer = 1 To numDays
    population *= growthRate
    lstFinalData.Items.Add("end of day …
ddanbe commented: Great explanation. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Suggestions for improvement - add the ability to re-assign a key that has already been assigned. You could do this by testing (in the common click handler) if the CTRL key was being pressed while the button was clicked. So click on a blank button means assign the next keystroke to the button. CTRL-click on a button, blank or otherwise means the same thing. You might also add the ability to unselect a button. If you followed my earlier suggestion of changing the BG colour you could determine if a currently selected button has been clicked again, in which case you could just unselect it and change thee BG colour back to default.

Also, you might want to ensure that you ignore assigning keys for values that have already been assigned to a button.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Here's one suggestion. This example uses a form with KeyPreview = True. You need this in order to process the keystrokes.

Public Class Form1

    Private CurrBtn As Button = Nothing

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        For Each btn As Button In Me.Controls.OfType(Of Button)()
            AddHandler btn.Click, AddressOf Button_Click
        Next

    End Sub

    Private Sub Form1_KeyUp(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyUp

        If IsNothing(CurrBtn) Then Exit Sub

        Me.Text = e.KeyCode

        Select Case e.KeyCode
            Case Keys.ControlKey
                CurrBtn.Text = "CTRL"
            Case Keys.A To Keys.Z
                CurrBtn.Text = Chr(e.KeyCode)
        End Select

        CurrBtn = Nothing

    End Sub

    Private Sub Button_Click(sender As System.Object, e As System.EventArgs)

        Dim btn As Button = sender

        If btn.Text = "" Then
            CurrBtn = btn
        End If

    End Sub

End Class

Precondition - all the buttons you want to dynamically assign must have the Text property set to the null string initially. The form load sub attaches the same handler to all blank buttons. CurrBtn allows you too select a button then activate it by pressing a key. You may also want to provide visual feedback by changing the button colour while it is active.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You might have a look at Perry's ID3 Tag Library. It's free and open source.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's actually less trouble to just show you the code than it is to chastize you for not showing any effort to solve it yourself ^_^.

Dim myFiles As New List(Of String)

For Each file As String In My.Computer.FileSystem.GetFiles("D:\temp")
    myFiles.Add(file)
Next

Dim rnd As New Random
MsgBox(myFiles(rnd.Next(0, myFiles.Count)))

What do you know. I was able to do both. I don't know of any vb.net book that doesn't cover these beginner level techniques.

rproffitt commented: +1 +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

On an unrelated note, if anyone is noticing frequent typos in my posts since last December (mostly consisting of repeated letters as in yoou and woulld) it is because Dell can seemingly not produce a laptop with a keyboard that is any better than complete shit.

But I'm not bitter

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm still not getting through here. What you are suggesting is a way to create variables

prop001
prop002
prop003
.
.
.

What I am saying is that what you really want is

prop(1)
prop(2)
prop(3)
.
.
.

You want to declare a variable number of variables dynamically which, in most cases, is just bad programming. All of the variables you want to create are closely related. They are all of the same type and differ only in value. Yes, you can create certain types of variables dynamically - objects, but not the simple types like strings, integers, etc. In vbScript you can use ExecuteGlobal to do this. While there may be a way to do this in vb.net I am not aware of it and wouldn't recommend it even if I was.

One suggestion was to create a variable length array and use ReDim Preserve as needed. I would also not recommend this. It's clumsy and slow. Lists and Dictionaries are much more flexible and easier to use. If you want to post a small version of the file you are processing perhaps your intentions will be clearer and I can provide a code snippet to illustrate what I am saying.

Teme64 commented: Not 120 variables for 120 values but 1 variable (array) for 120 values. This is the correct approach +11
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I think you are missing the point. If you just want to store a series (list) of strings (or numbers or whatever) you can declare a list and specify what you want it to be a list of. For example, if you want to store a list of strings you do

    Dim Props As New List(Of String)

    Props.Add("one")
    Props.Add("two")
    Props.Add("three")

    For i As Integer = 0 To Props.Count - 1
        Debug.WriteLine(Props(i))
    Next

The output in this case is

one
two
three

If you want a liist of integers you would do

    Dim Props As New List(Of Integer)

    Props.Add(412)
    Props.Add(634)
    Props.Add(18)

    For i As Integer = 0 To Props.Count - 1
        Debug.WriteLine(Props(i))
    Next

In this case the output is

412
634
18

You are not creating a list of variables. You are creating one variable which is a list of values.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I was under the impression that the FFT (Fast Fourier Transform) was an algorithm that had been patented. I may be mistaken.