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

Or if you can't or don't want to group the controls, set the Tag property of each to some known value then test in a loop like

For Each ctrl As Control In Me.Controls
    If ctrl.Tag = "my value" Then
        ctrl.Enabled = True
    End If
Next
iFrolox commented: Thank you for providing the code +1
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

As far as I know, the tools will allow you to reset the local password on a workstation or server (I've used ERD commander to do just that), but that won't help reset a domain password (again, to the best of my knowledge).

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

To do that you create an installer package. When a user runs the installer it copies all of the files needed to run the application to the user's computer. You can find detailed instructions here

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

I think he was referring to them selling more bandwith than they have available.

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

Oh yeah. The bars. I guess I never paid them much attention because I didn't notice them not being there any more.

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

The airlines do it all the time.

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

After much confusion and obfuscation I finally got to talk to someone at my summer ISP who was willing to give me some honest answers. It seems that the cell tower that services this area is overburdened such that when load is high (like on weekends), my internet pops in and out (mostly out at the moment). Overburdened in plain English means "we sold more accounts than we knew we had the equipment to handle". Of coure this doesn't show up a s a lost connection because my connection to the wireless hub is continuous. The diagnostic on the hub, however, shows my DND as PASS/FAIL/PASS/FAIL and so on.

So for the next while (like on weekends) I'll be popping in and out (and in and out and in and...)

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

I'd have your company lawyer contact the former admin.

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

Instructions on how to save settings can be found here.

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

When you encrypt it you are also encrypting the carriage return and line feed characters. As such, ReadAllLines can't parse the text back into separate lines. You'll have to encrypt and write each line separately to preserve the delimiters.

iFrolox commented: Exactly what i had to do, thank you for the reply. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Apparently I don't understand anything anymore. I keep getting inconsistent results with the same query. I'm beginning to suspect I am having some kind of network problem. I had my router set to use OPENDNS. When I set it to the TBayTel recommended settings (which I have found to be somewhat unreliable) of 8.8.8.8, the search query returned the expected results. Perhaps I'll just assume that strange things are the result of network gremlins until I return home in September.

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

I checked out your previous link. Did you try what I did in my last post? I did what I would expect anyone who is doing a search would do. My thinking is "let's see, I remember that the post was about encryption and I remember it was in the VB.NET forum so...". Using the next logical steps - entering those values in the search fields - results in no hits. What happens when you follow the steps that I just did?

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

Well it isn't working again then.

Go to a DaniWeb page

Click "Search" to being up advanced search

Enter "encryption", --VB.NET and Code Snippet

Click "Search"

You get "No Results" even though the articles exist

Software Development > VB.NET > VB.NET Code Snippets > Encryption and Decryption Functions In Vb.net

Software Development > VB.NET > VB.NET Code Snippets > Simple Encryption

You get the same results if you use "simple encryption" as the search term.

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

Try

For Each Info As String In System.IO.File.ReadAllLines(AccFileR)
    Info = IDecode.decryptString(Info)
    'Debug.WriteLine(Info)
    Accounts.Add(New Account(Info.Split(CChar(","))))
    My.Forms.Main_frm.AccNumber.Items.Add(iCount)
    iCount += 1
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Much better. Thank you.

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

The following code creates two dictionaries (one for each input file). If you are unfamiliar with dictionaries, consider them like improved arrays. With a regular array, the index is a number (starting from 0 and incrementing by 1) and the value is whatever type you have declared the array to be. So for an array of strings, myarray(4) is the fifth (zero relative) string. With a dictionary, you declare the type of the index (or key) and the type of the value (which can be a basic type or an object). You index the dictionary by the key. However, unlike an array, the keys do not have to be sequential (only unique). As a benefit, instead of searching for a particular key, you can let the dictionary do it for you using the ContainsKey method. It may be clearer if you look at the code. You should be able to take this code and figure out how to do the rest. txtResults is a multi-line textbox to display the output of the comparison.

Public Class Form1

    Const TEST1 = "D:\temp\test1.txt"
    Const TEST2 = "D:\temp\test2.txt"

    Private Sub btnCompare_Click(sender As System.Object, e As System.EventArgs) Handles btnCompare.Click

        'Declare two dictionaries. The key for each will be the text from the input line up to,
        'but not including the first ",". The valus for each will be the entire input line.

        Dim file1 As New Dictionary(Of String, String)
        Dim file2 As New Dictionary(Of String, String)

        For Each line As String In System.IO.File.ReadAllLines(TEST1)
            Dim …
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I can find it with google using "simple encryption site:www.daniweb.com". It comes up as the first hit. I just can't find it using the search provided by DaniWeb. It also comes up if I use the basic DaniWeb search (along with many other hits). If I try to narrow the search by providing the forum or the forum and the type of article I get No Results. Seems like this has resurfaced.

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

I was trying to find a code snippet so I used the advanced search with the following parameters:

Query String = encryption
Forum = --VB.NET
Type of Article = Code Snippet

It came back with "No Results"

When I did a manual search of code snippets under vb.net I found this article which I think should have come up in the search. The hierarchy on that article is

Software Development > VB.NET > VB.NET Code Snippets > Simple Encryption

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

It would help to know something about the input data. Are the lines in each file unique (within that file) or are there possibly duplicate lines? How big are the files (can you state an approximate maximum number of lines?). You read file 2 once for each line in file 1. This is not very efficient. You also do a split on both lines in the inner loop. Also very inefficient. You would be better off reading and splitting the lines in both files into arrays (or dictionaries) then doing the loops to compare. If you can give me a little more information I'd be happy to help you out.

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

The scriptable component, autoitx, uses a dll named AutoItX3.dll (or AutoItX_x64.dll).

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

Have you looked at autoit. There is a component, AutoitX, that can be created and used from within vb.

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

lime chili peanuts and a tall glass of cold water

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

I have the same problem; loss of high end frequencies (age related). I find voices muffled and loud background (?) music doesn't help.

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

Upon further reading I found that there is a better way to prevent two (or more) threads from modifying the shared data.

Dim filename As String

SyncLock changeQueue
    filename = changeQueue.Dequeue
End SyncLock

You can use the SyncLock to block all other threads from modifying changeQueue (or other structures). It is important to restrict the time that your code spends inside the Sync/End Sync so as to block other threads for as short a time as possible. Note that this only works as long as everyone plays by the rules. In other words, this only blocks access to other threads that also enclose access to the data in Sync/End Sync blocks.

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

Forget the problem with commercials being blasted at you, I've noticed in a few of my regular shows lately, noticibly Burn Notice and Royal Pains, dialog is at one volume level, and the music that plays between scenes (camera pans over scenery/cityscape, etc.) is at three times the volume. It requires me to keep one hand on the remote volume at all times lets I miss the dialog because the volume is too low, or suffer even more hearing loss because the volume is too high.

Or is it just me?

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

I remember how much "fun" I had doing all those multi-user/multi-process apps for the first time. I hope I saved you from some of the grief. Thanks for the interesting problem. It gave me a reason to learn how to code a multi-threaded app. Feel free to come back here often.

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

It's possible the folder has had the S or System attribute set. Open a command (CMD) shell and locate to the folder that contains the missing folder. Let's assume (for this example) that the missing folder is called "dave". At the command prompt type the command

attrib dave

If you see an S to the left of dave then the answer is yes. An H means the file is Hidden. Files can be regular hidden (H) or super (or system) hidden (S). Files and folders with the S attribute set will not be visible even if you enable "show hidden files". To clear the flags you can type

attrib dave -s -h

this will clear both the Hidden and System attributes. Once you have done this you can check if your folder is now visible.

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

I think it would be nice to include the original posting date when a related article is suggested. I'd be more inclined to check it out if I knew the article was less than a few months old. More than a year, not so likely.

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

Is it possible you have the wrong encryption settings for tis particular wireless connection? It's possible that one end is set to WEP and the other to WPA. Are you being prompted for a network key when you try to connect?

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

In case no one has mentioned it before, I just want to say a public thanks to Davey for all of the interesting news items he finds the time to write up and post.

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

It stayed in edit mode. I was able to make the preview window appear/disappear repeatedly. I closed and reopened the page four times, submitting the post each time. The post never appeared. I tried again after submitting this bug report and that time the post went through. If you check it now you will see that only one copy of the post is present. But on the bright side, at least the cursor is in the correct position.

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

I don't recall that we ever had a view counter. Of course, that could just be me.

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

I just finished trying for the fourth time to submit a posting to the "Articles View" thread. Every time I click "Reply", the Reply button disappears but I am left in edit mode.

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

I could only do so much testing here so I hope this helps.

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

I wrote up two skeleton apps. The first is the server that runs the folder watch and the generator. The second is the client app. Both are missing the code to load and process the Excel files (hard to do if you don't know what the processing or data are). I've also attached the zipped project files.

Server App
Imports System
Imports System.Collections

'                                                                                                   
'  Name:                                                                                            
'                                                                                                   
'    EruditioServer (catchy name, don't you think?)                                                 
'                                                                                                   
'  Description:                                                                                     
'                                                                                                   
'    This app monitors the folder given in PRODFILES and watches for rename events on xls files.    
'    It assumes that this will only ever happen when a .tmp file is renamed to .xls upon the        
'    completion of an edit by a user.                                                               
'                                                                                                   
'    When a .tmp is renamed to .xls, this app starts a background thread which takes the newly      
'    edited .xls file, opens it to create a one line summary, then updates a summary file with      
'    that summary.                                                                                  
'                                                                                                   
'  Notes:                                                                                           
'                                                                                                   
'    This code is just a skeleton. It includes no extra code to actually process the Excel files.   
'    That code is left to the implementing programmer to fill in.                                   
'                                                                                                   
'    I understand that all of the .xls files are processed automatically during the night to        
'    ensure that no summaries were missed. It should be an easy matter to add that functionality    
'    into this code by creating a timer which would scan the PRODFILES folder and add all .xls      
' …
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That simplifies things. With a little luck I'll be able to post some skeleton code for the user and control apps showing the interlock logic. This will be my first multi-threaded app under VB, but I am optimistic it will work.

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

If the string contains arbitrary numbers of substrings of the form "Kg###" then you can extract them all using a regular expression as follows

Imports System.Text.RegularExpressions

Public Class Form1

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

        Dim test As String = "_A0+0000002 Kg054__A0+0000002 Kg055__ "
        Dim rexp As New Regex("Kg(\d*)")

        For Each m As Match In rexp.Matches(test)
            Debug.WriteLine(m.Value)
        Next

    End Sub

End Class

The output of the above code is

Kg054
Kg055

You can strip off the leading Kg by either substringing or replacing "Kg" with ""

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

Keeping all the lines in order wouldn't have any effect on the GOTO

In that case I think you can get away with

       Dim newline As Integer = 0

        For Each line As String In System.IO.File.ReadAllLines("D:\temp\jumpin.txt")

            ListBox1.Items.Add(line)

            Dim linenumb As String 'the N#### portion of the line
            Dim linecode As String 'everything other than N####

            If line.StartsWith("N") Then
                newline += 10
                linenumb = Split(line)(0).Substring(1)
                linecode = line.Substring(Len(linenumb) + 1)
                line = "N" & newline.ToString("0000") & linecode
            End If

            ListBox2.Items.Add(line)

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

We had a similar situation where we had a client computer set up to continuously run a river flow optimization program. It was pretty CPU intensive so we decided it would be better to not have it running on the server.

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

The text files are edited, rather than recreated.

I'm confused. Do the users edit the text files or the Excel files?

It occurred to me as I was coding up a shell example that because you are rendering many Excel files down into a few text files, you are likely going to have to process all of the Excel files every time any Excel file is modified. This might not be the case, but because I do not know the nature of the files I can't really make an assumption either way. Depending on the situation this may simplify the processing. If you have to process all of the Excel files then it is not necessary to know which file has changed, only that a change has been made.

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

Before I retired I always found it useful, when I got a request, to rewrite the request in my own words and send it back to the person making the request with the question, "is this what you are asking for?". I found that in most cases what I thought the user wanted was not in sync with what the user said he wanted. So let me restate the problem to make sure we are in agreement.

  • You have hundreds of Excel files in a shared folder.

  • These files can be edited by multiple users.

  • The information in these files is used to generate a smaller number of text files.

  • When an Excel file changes, the text files must be recreated

You can't have more than one file watcher active at a time. If the file watcher was part of the user app then every time any user save his changes, ALL copies of the file watcher would trigger the same event. Therefore you must have only one file watcher running and logically it should be on the server.

Also, a server is generally much more powerful than any client PC. Because the files are stored on the server there is no network latency when processing the files. Therefore it should take much less time to generate the text files on the server than on a client. It is also less likely that the server will be interrupted while processing. Client machines can be subject to power outages and …

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

The client has to be told some setup information in order to connect to the server. For example, the client must know beforehand either the server name or address. Why not just give the client the share name at setup?

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

Another thought on the server process. You could bundle the FileSystemWatcher and the generation process in one app and just make the generator a separate thread. They could share a common structure which would be a list of files that were renamed. As long as you also share a variable that can be used as a lock so that both threads can not update the list at the same time everything should be fine. I've never programmed a multi-threaded app in vb but the basics seem pretty, well, basic. It would be easier for two threads in one task to communicate than for two separate tasks.

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

So now it doesn't matter that the lines of code are out of sequence?

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

Usually, when you make resources on a server available to the network you do it through a share name (or Active Directory name) rather than by a physical path. For example, if your sdf file was physically located on a server named Hermes in the folder D:\database, the users would access it through a UNC name like \Hermes\sharename

Access rights to the folder are maintained on the share rather than on the folder or file. As server requirements change, the file can be moved to another folder and the target of the share can be updated without having to notify the users or modify any applications. Also, access rights do not have to be updated.

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

When the picturebox is loaded with a picture you could put a string into the Tag property. When you click on the picturebox you can copy the Tag value to the TextBox.

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

I had a recent exchange with a user. He had posted a lengthy snippet of code as a proposed solution to a question. The code was undocumented and uncommented so I replied that adding some comments might make the mechanics of the code clearer. His response was "I did not realize that it was a requirement of this site to post fully documented code." Clearly there was some disconnect between what I requested and what he thought I requested. It reminded me of a favourite saying from my dad

There is a difference between scratching your [backside] and ripping it to shreds.

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

For Each linenumb As Integer In sd.Keys
ListBox1.Items.Add(linenumb.ToString("0000") & sd(linenumb))
Next

If sd is the SortedDictionary in my first response then

Dim newline As Integer = 0

For Each oldline As Integer In sd.Keys
    newline += 10
    ListBox1.Items.Add("N" & newline.ToString("0000") & sd(oldline))
Next

will add the code to ListBox1 with line numbers ranging from N0010 in increments of 10. Warning - if the old line numbers are used as the target of a GOTO then the GOTOs will point to the wrong lines after the resequencing.

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

If all of the people on Facebook were considered a country, it would be the world's third largest.

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

Lets try this setup as a possibility. I'm going to make a few assumptions:

  • Excel files are in \server\excel\prod
  • Working files are in \server\excel\work
  • generated text files are in \server\excel\text
  • prod files named datafile-###.xls
  • work files named datafile-###-user.xls

You want only one copy of the FileSystemWatcher (FSW) running. I'm assuming this would be on the server hosting the files. FSW could be set to monitor FileName events and could ignore everything but Rename events. The Filter would be set to "*.xls" in the prod folder. The reason you want to use Rename events only is because you can get multiple Change events for one change and you don't want to trigger multiple times for one change. Also, a Rename is virtually instantaneous. By the time the action causes the trigger the file is available for use.

When a user selects an Excel file via the FileOpenDialog, your code would check to see if there is already a working file for that Excel file. If there is, then the user is told so, and possibly also which user has that file and for how long. If not then a working file is created from that Excel file and opened for editing by the user.

If the user abandons his edits then the working file is deleted. If the user saves the changes, then after the changes are written to the working file, the original (in prod) is deleted and the temp file is renamed to the original name. This triggers …

Eruditio commented: Sound advice. This ended up fixing the problem. +0