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

At the time of the writing of Charles Dickens', A Christmas Carol, "scrooge" was a slang word synonymous with the word, "squeeze". And "a humbug" was a person who put on false airs as in a person who behaves as if everything is rosy when his life is anything but. What Scrooge disapproved of was the false display of gaiety and good will from people who behaved otherwise the rest of the year.

mike_2000_17 commented: Cool! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I want to get sum of total data where status is "yes"

What you should provide is

  1. the structure of all relevant tables
  2. perhaps a few records with an example of the before and after

This is particularly helpful if you are trying to explain the problem in a language that is likely not your native tongue.

Begginnerdev commented: To eager to solve questions. Sorry. :( +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's going to get worse. A Republican Congressman from Texas, Louie Gohmert, says the elementary school principal in Newtown, Conn., should have had a high-powered rifle to take the shooter’s “head off.” Texas Governor Rick Perry says teachers and administrators should be able to carry concealed weapons. And the state of Michigan, just one day before the Newtown school massacre of 26 children and adults, passed a bill to allow the carrying of concealed weapons in schools, daycare centres and places of worship. If guns is the problem then obviously more guns is the solution.

Wanted: School principal. Must be expert marksman.

diafol commented: I'm glad it's not just me that sees the madness of this obsession +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

@MICHAEL - He's doing a post-doc in bio-physics.

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

google this and check out the first three hits.

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

My Christmas gift is having my older son fly home from Long Island to spend the holidays with us. He's due here Wednesday evening.

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

I only put "some text" into the string for testing and to demonstrate that the text is still there inside the event handler. You can assign it any text you want at any point in your code. As tinstaafl points out, if you declare fo1 inside the handler it overrides the global copy with a local one and makes the global fo1 inaccessible.

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

Your code

Dim path As String = Directory.GetCurrentDirectory() & "\Setings.txt"
If File.Exists(path) Then
    Dim test1 As New System.IO.StreamWriter(path, False)
    test1.WriteLine(fo1)
    test1.Close()
    MsgBox(fo1)
Else
    Dim fs As FileStream = File.Create(path)
End If

will not write anything to the file if the file does not exist. Look at it in pseudo code

compose file name

if the file exists then
    write the contents of fo1 to the file
otherwise
    create the file but don't write anything to it

As I mentioned before, the WriteAllText will create the file if it doesn't exist so you don't need the test. The following seems to be what you intended

Imports System.IO

Public Class Form1

    Public fo1 As String = "some test text"

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

        Dim filename As String = Directory.GetCurrentDirectory() & "\test.txt"
        MsgBox("writing " & fo1 & " to " & filename)
        My.Computer.FileSystem.WriteAllText(filename, fo1, True)

    End Sub

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

how to find all data in my first listview to another

Can you please explain what you mean by this?

TnTinMN commented: and I thought I was the only one who din not comprehend that +6
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

When I used to write apps for a living, the problem was keeping the users current. I couldn't push out the updates because a lot of the users had laptops and I could never predict when they'd be on the network. My solution was to put a script under the app icon instead of the app itself. The script would copy any new modules from the repository before launching the actual app.

I'm sure there are more modern ways to do this but I used what was available at the time. It was simple and it worked.

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

So in pseudo code

For Each "Code Name" in the listview
    get all calls and visits for that Code Name
Next

and in real code that is

Dim query As String

For Each item As ListViewItem In ListView1.Items
    query = "Select * from [Calls and Visits$] where AM like '" & item.SubItems(1).Text & "%'"
    'execute the query and do something with the results
Next
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The wood burns a lot faster when you have to chop it yourself. Harrison Ford

Some people are born on third base and go through life thinking they hit a triple. Barry Switzer

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

I want to learn something new in these vacations.

Learn to relax. It seems to be a lost art.

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

the robot/human said, "Big things have small beginnings".

Hardly an original quote. There is an ancient one about mighty oaks springing from acorns.

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

Try running msconfig and select "Safe Boot" and "Minimal" on the Boot tab. Then reboot. If that doesn't work then try selecting "Diagnostic startup" on the General tab.

Stuugie commented: As always, thank you very much +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You could just use a file browser control on form load and ask the user to select the appropriate *.accdb file. Of course, you'd have to ensure that the selected file is one that actually contains the correct tables. Remember to set the file mask to restrict the selection to accdb files.

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

Aside from the Kinect I can't think of anything.

<M/> commented: Did they invent it? :) +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I tried the following code and it worked fine. Note that I didn't bother filling in complete code for all fields. This should be enough to give you the idea.

If My.Computer.FileSystem.FileExists(infofile) Then

    For Each line As String In System.IO.File.ReadAllLines(infofile)

        If Trim(line) <> "" Then

            Dim fields() As String = line.Split(":")

            Select Case UCase(fields(0))
                Case "DESCRIPTION"
                Case "FLOWERING"
                Case "HEIGHT"
                Case "SPREAD"
                Case "TEMP"
                Case "ZONE"
                Case "MOISTURE"
                Case "LIGHT"
                Case "CULTIVATION"
                Case "PROPAGATION"
                Case "DISEASE"
                Case "LANDSCAPE"
                Case "COMMON"
                    Debug.WriteLine("COMMON NAME = " & Trim(fields(1)))
                Case "LATIN"
                    Debug.WriteLine("LATIN NAME  = " & Trim(fields(1)))
                Case "COLOR"
                    Debug.WriteLine("COLOR       = " & Trim(fields(1)))
                Case Else
                    MsgBox("unknown field " & fields(0))
            End Select

        End If

    Next

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

You could try setting the forms KeyPreview property to True. You'll have to do some pre-processing in one of the form's Key events (KeyDown, KeyPress, KeyUp) to ensure the characters are handled properly.

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

False assumption. You all assume the candles burn at an even rate. They would not if they were tapered candles. Also, a candle will burn faster when turned horizontally as the wax will melt and drip off rather than burn.

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

Make your own then.

I'd rather remove my own spleen with only a bottle of scotch and a rusty razor blade than do web programming. It's much easier to just complain. I'm old and it's what old people do best :P

pritaeas commented: Well said! +0
Nick Evan commented: Hehe :) +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Now if I could only remember where I left my car keys and my glasses.

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

I refuse to use an online bookmarking system that I don't trust and I do not trust Google, Facebook, LinkedIn, etc to keep my information private.

However, I trust DaniWeb so I would have no objections to storing DaniWeb bookmarks on DaniWeb itself.

Dani commented: Thank you for the vote of confidence! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In Total Recall he lost his arms while he was dangling from the elevator. In The Machinist it was in a piece of shop machinery. In Starship Troopers it was in a sandpit while being attacked by bugs.

LastMitch commented: You are a got memory! +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In 1998 my entire group moved from our old control centre into a brand new, state of the art, hurricane proof, hi-tech, custom designed building. Including the system control operators, support staff and R&D staff there were about 85 people in the new building. After a month of settling in I wrote in big block letters on an easel in the main conference room what I think was an original quote from me.

Just because everything is different doesn't mean anything has changed

Sure enough. For the next ten years it was the same old bulls%%t. I think this ties in nicely with the Einstein quote above.

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

You can use the TextChanged event handler of TextBox2. In the body, just add code to copy the new value to TextBox1 as in

Dim txt As TextBox = sender
Form1.TextBox1.Text = txt.text
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Surprisingly, "Being There". Possibly Peter Sellers' best performance. And, as an aside, IMO the best ever performance (ever) by an actor was by Peter O'Toole in Lawrence of Arabia. Further seque, has nyone here ever seen "The Ruling Class"?

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

I don't have access to my dev environment for the next few days so I'll try from memory. You can read all lines of the file into an array as follows

Dim questions() As String = System.IO.File.ReadAllLines(filename)

Then you can step through each question as

For Each line As String In questions

    Dim fields() As String = line.Split(",")
    Dim num1 As Integer = CInt(fields(0))
    Dim num2 As Integer = CInt(fields(1))
    Dim num3 As Integer = CInt(fields(2))       
    .
    .
    .

Next

You may have to verify the System.IO.File.ReadAllLines part.

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

I don't have access to VB while my computer is in the shop but let me make a suggestion (you'll have to verify the syntax). You can check all of the textboxes on the form by

For Each tbx As TextBox In Me.Controls.OfType(Of TextBox)()
    If tbx.Text <> "" Then
        'process textbox with content
    End If
Next

If some of the textboxes do not need to be checked then you can either put all the ones to check in a groupbox and just check within that group, or you could place some value in the Tag property of each textbox to check and ignore the ones without that value.

So lets say i added content to the 1st textbox/selected textbox.
I want it to save just that.

You can't check only the selected textbox because by clicking the button you deselect the textbox.

john.knapp commented: nice... much cleaner than mine +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Short answer - The Shawshank Redemption.

mike_2000_17 commented: I second that! +0
<M/> commented: lol +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I wrote a sample code snippet that demonstrates how to use a BackGroundWorker control. Perhaps that can give you a start. My regular machine (with all the dev tools) is in the shop so that's the best I can do at the moment.

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

You could also use a dictionary as in

Dim transform As Dictionary(Of String, String)

and populate it where the key is the original char and the value is the replacement. Then you can do the replacement by

For Each key as String In transform.Keys
    TextBox4.Replace(key,transform(key))
Next

Caution - this will fail if any of the replacement strings contains any of the chars you are replacing.

john.knapp commented: +1 for scalability +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Are you trying to get answers to your own questions?

At first I was here to get answers to questions. As I got more comfortable with DaniWeb I started "putting back in" by answering questions. Now I'd guess I run about 99% answering and 1% asking. I'm not saying that all the questions and answers are gold but I do try to get more hits than misses ;-)

What value do you get from helping people?

One thing (among many) that really annoyed me at work was information hoarders. A number of people felt that by not sharing their knowledge it made them more valuable. I've always been the opposite. I've always been willing to share what I knew. I felt that being a resource for others made me more valuable. This turned out to be a good career move because for the first few years I was the only person in all the computer groups who was doing scripting (mostly vbScript but also some ReXX). It turns out that there are many situations where scripts are much preferred over compiled code.

I've always been interested in how things work. I find that I am answering the same simple questions again and again. This can get a little tedious, but I recall when I was at the same level as some of these posters and needed a little help. Every so often though, someone asks an interesting question that requires a little research and a little …

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

Fortunately I love music. I had to wear headphones at work to deter my coworker from interrupting me every five minutes to "chat". Sometimes I'd wear them with no music on and just ignore him.

ChrisHunter commented: Yes ! I used to do this at work and still do it on the train. That or close my eyes so no one bothers me on the train. +0
<M/> commented: like a boss :) +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I think it is called Axe because standing next to someone wearing Axe is like being hit with one in the face. In my day (way way back) the pollutant of choice was Brut.

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

baddly written short snippets

Or how about snippets that don't mention that they don't work unless you add a reference and do an import and bloody well good luck trying to guess which ones

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

I know that the language is constantly evolving but THERE ARE RULES, PEOPLE!

I hate it when I am shopping and the someone in the aisle ahead of me parks their shopping cart across half the aisle, then blocks the other half with their body while they scan the shelves.

I hate it when people stop in doorways to

  • check their bill
  • look for their car keys
  • anything else

It basically boils down to people who don't bother to think about anyone else.

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

A lot of grammar peeves such as

People who don't know how to use reflexive pronouns

"How are are you?"

"I'm fine. Yourself?"

It's called reflexive because it reflects back. You can say "I will do it myself" because "do" relects back on "me". You can't say "If you need more information please call myself" because "call" refers to an action by some other person than you.

People who use "I" instead of "me" thinking that it makes them sound educated and proper

"There has always been tension between my mother and I." If it's the object (of a verb or a preposition) then use "me". If it is the subject then use "I".

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

A cleaner add would be

For Each dRow In dt.Rows

    Dim item As New ListViewItem(dRow.Item(0).ToString)

    For i As Integer = 1 To 8
        item.SubItems.Add(dRow.Item(i).ToString)
    Next

    ListView2.Items.Add(item)

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

Or you could do str = str.Replace("-eng","")

Stuugie commented: Thanks once again +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My regular computer is in the shop and I don't have VB on my replacement but I think the RichTextBox control has a built in method for reading and writing files. I think they are called LoadFile and SaveFile.

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

The point is to make a worthwhile contribution. My following comment is not meant to point out any similarity but only to make a point. A few months ago we had a member (now banned) who was making dozens of posts daily in Thoughts of the day. Most of the posts made no sense and the only reason I could see for making them was to boost his activity points. The big problem with posts like that is that it dumbs down the other content by sheer volume.

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

how do i subtract and add values to each fields for every single transaction on the same table

That is very ambiguous question which I tried to answer. Are you saying you want to modify each field (doesn't make sense but that's what you said)?

Where do i exaclty put the Select Title?

After line 117.

adam_k commented: :D +8
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Thanks. It seems a lot of examples of code in books are like this.

john.knapp commented: LOL +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The code in this snippet (and attached project zip) demonstrates how to use a background worker thread to monitor a network address (name or IP). It shows how to start and stop the thread and how to update controls in the main thread using delegates. It should be simple to use this code as a template for creating background threads for other tasks.

A couple of quick notes:

You may wonder why I have tab characters padding out my comments. It becomes more obvious when you set the comments to display with black foreground and light grey (or silver) background. When you do this it becomes a little prettier to look at. I prefer shaded comments because it more easily distinguishes code from comments, and makes it more obvious when code is commented out.

<edit>It looks like trailing blanks/tabs are automatically removed</edit>

The attached file is named as "yyyy-mm-dd hh-mm archive.zip". I don't use a CMS. When I get to a checkpoint I have a script that archives a folder. It prefixes the project folder name with the current date and time.

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

Don't use SUM. That is used to return the result of adding up several records. For example, if you had a table of sales data and you wanted to know the total sales for the Eastern region you would code

SELECT SUM(Sales) AS TotalSales 
  FROM Sales_Table
 WHERE Region = 'Eastern'

What you want to do is calculate the Total of the individual marks for each record. If we ignore the test for NULL values the query is

UPDATE tblClass1 SET Total = Physics+English+Chemistry+Biology+History

You don't need (or want) to do either of the following (both of which are invalid)

UPDATE tblClass1 SET Total = SUM(Physics+English+Chemistry+Biology+History)
UPDATE tblClass1 SET Total = SUM(Physics,English,Chemistry,Biology,History)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I once took a half course in compiler writing. It was three hours a week for three months (this was in the days before YACC). Operating systems are much more complex. If you are expecting someone to spoon feed you through many hours of one-on-one instruction then you have the wrong idea about this forum. Daniwebs offer technical support. It does not offer tutoring services. There are books and other resources available if you want to write your own OS. Start with Google and work from there.

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

Took me five minutes to find it here

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

Definitely my cat, Zoey.

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

If you want to get some idea of the complexity, google

mozilla thunderbird source code download

and get the source code for Thunderbird.