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

It's been a few years since I've done database stuff but I suggest that instead of just displaying a generic error message like "New Record FAILED. Please contact your systems administrator." you display the actual error message returned in the exception. It should be one of the properties of the variable ex. It will likely give you more details.

And, if I may, I'd like to say again that these kind of questions do not belong in the community forum so I moved it to a more appropriate location.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
  1. Open an Explorer window
  2. Right click on This PC and select Properties from the pop-up menu
  3. In the Control Panel window click on Advanced system settings
  4. Click on Environment Variables

At this point you have to decide if you want the change to apply to just the current user, or for all users. You will click on Path in either the upper list (current user) of the lower list (all users).

  1. Click on the appropriate Edit... button.
  2. In the Edit environment variable window click New
  3. Enter the desired path info into the edit box
  4. Click OK
  5. Click OK
  6. Click OK
rproffitt commented: OK. OK. OK. Don't take this wrong, that's how it's done. (Are your sure? OK!) +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I just finished watching the 2015 documentary, "Can We Take a Joke" and I was prompted to add one last comment...

When I made my original post I was actually expecting at least one person to reply by calling me either a racist or a bigot or an Islamophobe or something similar. I was instead surprised and pleased to enter into a rational discussion. It may not have come across but I made my post with the intention that I was willing to have my mind changed. That is, after all, the entire point of having a discussion. Maybe that's just an old fashioned idea these days.

Dani, thanks again for your insightful comments.

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

I could, but if you don't even know how to start then you know nothing about loops. That means you are either skipping class or sleeping during. Reread your notes or look up the syntax of C++ loops. I think there is a thing called Google that might be of help.

I should point out that technically

a for loop that prints the numbers 50 to 30, in reverse order

Might not be what you think. The numbers from 50 to 30 would be

50 49 48 ... 31 30

The numbers from 50 to 30 in reverse order then would actually be

30 31 32 ... 49 50

Best to clarify that question. As someone learning (or I hope you are learning) to program, one of the most important lessons is to get clarification on any spec that is ambiguous. Clear communication is key. As a long-time married person I am only too aware that two people can hear the same sentence and understand it to mean two different things. To wit - if today is Tuesday and someone says "see you next Saturday", do they mean in four days (this Saturday) or in 11 days?

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

The second one (unused b) was leftover code from previous attempts while figuring the current version out. I just neglected to remove it. Thanks for noting what could be improved.

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

Looks to me like you have put zero effort into doing it yourself. Please read the Daniweb Posting Rules and Suggestions For Posting Questions.

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

The trick is to try doing it by hand first. Write down all the steps to get the desired results. It has to be clear enough that another person would be able to do the task only from the instructions. Those instructions are your pseudo code. Then it's a matter of translating that set of instructions to c# code.

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

There is a cult of ignorance in the United States, and there always has been. The strain of anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that ‘my ignorance is just as good as your knowledge’.

  • Isaac Asimov, January 21, 1980
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Those recommendations are worthless without an explanation as to why you think each belongs on that list. Keep in mind that different people have different requirements and as such, what is a "good" tablet for one person might not be "good" for another.

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

My apologies. Too many irons in the fire today. I didn't read your post carefully enough.

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

I would strongly advise against doing that. Alt-Tab is a basic Windows function and I can't imagine that you would want to override that except for some underhanded purpose.

vinodvinu commented: Thanks for the reply, But this necessary for me. +3
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

A long standing complaint with the standard progress bar control is that there is no easy way to display text. In spite of numerous requests, Microsoft has not included this capability. The following code includes a class, CustomProgress which inherits the standard ProgressBar and adds such a feature. It is fairly easy to use. If you want to show a percentage progress you set Text to a null string and the percentage will be calculated from the Minimum and Maximum value properties. If you want a custom string then assign it to Text. Either the percentge or custom text will be displayed when you call the Update method.

You can include the class code in your project, or if you are more adventurous, you can create a custom control and add it to your toolbox.

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

I suggest you do something like

dim qry as string = "INSERT INTO Table VALUES ('" & PatientID.Text & "', '" & fname.Text & "'," & lname.Text & "')"

and examine the contents of qry. There is no way for us to see what the query is without knowing the values of the text fields that make it up.

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

Without looking up the exact syntax, you might try something like

prompt = "OK, " &  name &  ". Please enter the cost of     the " &  item & ": "
balance = float(input(prompt))

The concatenation operator may be a + instead of &.

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

It's been quite a while since I used a version of BASIC that old but I suspect

balance = float (input("OK, ", name, ". Please enter the cost of     the ", item, ": "))

is complaining because of the number of parameters you give for input. Try concatenating all of the values and passing them to input as one string.

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

I would just download VeraCrypt Portable (free) rather than write something from scratch.

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

I corrected the code formatting.

Please note that of lines 29 and 30

Exit Sub
rs.Close

there is no way that line 30 will ever get executed so it is possible this is leading to your error by leaving the connection open.

Also, line 141

If rs.BOF = False And rs.EOF = False Then

could be better written as

If Not (rs.BOF Or rs.EOF) Then
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You have to iterate through all of the items in the listview collection and convert them to string before you write them out. If the collection is small then you can create the output buffer in a loop then use WriteAllText to blast it out in one step. I suggest you use a StringBuilder object to do this as it efficiently concatenates strings whereas just concatinating many regular strings is very inefficient. If you have a large listview collection then you can open the output file as a stream and write the lines one by one,

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

Because you can write clearer and more concise code if you overload operators so that they can be used on objects. For example, you might want to overload + so that you can write

object1 + object2

instead of creatinig an Add method which would look like

object1.Add(object2)

The first form is clearer and makes more sense conceptually.

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

The thread has been dead for more than 8 years. What do you think?

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

vbScript - Extending Application Functionality with vbScript and AutoIt

Sometimes you'll find that one of your favourite applications is missing some useful functionality. For me, it was FastStone Image Viewer. I've had to scan a large number of family photos to convert everything to digital. Rather than scan one photo at a time, I found it faster to fill the scanner and scan an entire page at once. That reduces the overall scan time but it means that I have to crop and save each individual photo from the gang scans.

FastStone has a crop board where I can select an area and Lossless Crop To File. Unfortunately, it autogenerates the file name by appending _cr to the current file name, so each succeeding crop to file overwrites the previous.

Using a free third party package, AutoIt and vbScript I can add the functionality.

The first step is to run the included tool, AutoIt Windows Info. Once this is running I then run FastStone, invoke the crop board, select an area, and choose Lossless Crop to File. I then select the control which contains the file name. The AutoIt tool tells me that the control name is Edit1.

Now, using the AutoItX component of AutoIt I can create a vbScript module that will run continuously in the background (but only when I need to do a lot of cropping). This script will continuously loop and watch for the creation of a window with the title Lossless Crop to File. …

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

I think the problem is that people see Code Snippet in the drop down and think that because they are including a snippet of code with their question they should select that option.

  • Captain Obvious
rproffitt commented: ...meets Captain Oblivious. I sense a lot of folk don't put effort into their questions. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm far from a python pro but it seems to me that xx is local to plotSVC and goes out of scope once that function exits.

I suggest you try to keep all module code contiguous. You have defned plotSVC in the middle of your mainline code. This is a very bad habit to get into. Keep all the mainline code as one contiguous block.

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

Two possible solutions:

  1. Put code in the text_changed event for the two textboxes (you can use the same event handler for both) that computes the sum and puts it in the third textbox.
  2. Because you are getting the values from a database why not just add sum(val1,val2) to the query and write all three values to the textboxes at the same time.
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Nope. Still doesn't work in Chrome.

rproffitt commented: Will test in Chrome now. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

2019-03-29_143623.jpg

This post has no text-based content.
rproffitt commented: There's a cat named Brexit. See next post. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You'll get help here but not until you first show you have put in the effort to do it yourself. When you run into specific problems you can post your questions.

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

This sounds like a very bad idea for two reasons:

  1. The code is overly complex (tricky) for the task and I believe that with very few exceptions, clear code is always preferable to tricky code.
  2. If anything breaks the process midway through the original file is corrupted.

Having said that, I admit that it was an interesting and clever approach.

rproffitt commented: In the news, MySpace server transition loses over a decade of uploads. "My code is quite the trick." +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I don't know what kind of response you are expecting. Are we supposed to provide a list of all of the topics covered in the hundreds of thousands of posts? My suggestion is to browse the forum post headers and see. Aside from many very informative articles by our esteemed associate, happygeek, you will also find programming tutorials and code snippets. You will also find answers to questions regarding computer hardware and software whether commercial or home grown.

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

I used to have one of those. Backups took hours. Double for a backup & verify. During that time the computer was useless. Now I just use disk imaging for my system partition and robocopy for my data partition. And because of shadow copy, I can use my computer during an image creation.

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

I think the only thing they learned is how to prevent getting caught again.

rproffitt commented: If (caught) get hard2catch; +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

How about googling "generate random numbers in python"? That would have required less effort than posting your question here.

rproffitt commented: Some colleges actively teach students to not google it. "Here's my book on that" Prof. Soandso. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can use DateDiff to calculate the difference between the current date and the entered date. Just out of curiosity, how do you guarantee that the user is entering their actual birthday? And if you can't guarantee that then what is the point of asking? If it's for legal reasons, why not just have a button that says "I agree that I am at least 15 years old".

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

For a paper with no pattern you would just add the area of the four walls and divide by the coverage-per-roll to get the number of rolls. I find it hard to believe that you are papering a room that is 20 feet high but using your numbers the total area would be

18 x 20 x 2 + 15 x 20 x 2

which works out to 1320 square feet. Based on 45.5 square feet per roll that results in a tad over 29 rolls. But you have to consider the pattern. The amount of waste will depend on how much of the roll you will have to throw away in order to align the pattern of one strip with the pattern ot the next strip.

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

No one is going to do your homework for you. If you hadn't waited to the last minute you could have posted your code and asked for help.

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

Typically Canadian...

A grocery store in Kingston Ontario forgot to lock up on a holiday. With doors open and no staff to keep watch, only two items were taken - two cans of cherry tomatoes for which the "customer" left $5 (more than the value of the items).

rproffitt commented: Must of been out of maple syrup. But I lived in Van,BC for years. It was nice. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

To be fair, "password" could be the encrypted/hashed value. It is not necessarily in clear text. Although I suspect you are correct in your assumption.

rproffitt commented: It's been only a few years since I opened up a college textbook and yup, clear passwords. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

At the risk of sounding callous, if your kids are falling for this then

  1. You have failed as a parent to teach your kids anything of value
  2. Chances are they are going to fail at life anyway

I suspect this is yet another in a long series of media scares. Remember the "punching game" thing from a few years ago where (supposedly) gangs were going around and viciously punching strangers at random? How about the "slender-man" scare? Remember, if they can keep you scared they can keep your eyes glued to the news feeds. If you are capable of making decisions rationally (out of logic) or emotionally (out of fear) but not both.

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

Or you can just do an explicit cast as

Dim b As Button = DirectCast(sender, Button)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It prints out 2 when I run it.

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

It's Feb 27 13:06 (CST) and I just got another password reset email dated Feb 24 17:38.

rproffitt commented: What was said long ago about how to really muck up a system? "Let's use a computer." +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can't. But you can do what I do. I set up a folder with links to each forum I want to go to with the filters I want (which are exactly none). For example, Hardware and Software links to https://www.daniweb.com/hardware-and-software/all/_/1 instead of https://www.daniweb.com/hardware-and-software/1

2019-02-27_123710.jpg

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

I agree so I changed it to a discussion thread.

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

I've been generally happy with Wrox books. You might try Beginning Python by Peter Norton, Alex Samuel, David Aitel, Eric Foster-Johnson, Leonard Richardson, Jason Diamond, Aleatha Parker and Michael Roberts. You might also check out Programming Python by Mark Lutz (O'Reilly).

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

Why would you expect any output? You've defined a class with methods but you haven't created any instances of that class. You code doesn't have any mainline section so nothing is being executed.

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

If you want something like Adobe Photoshop then check out gimp. It's powerful and free.

rproffitt commented: And The GIMP has source code for the taking. +0
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
  1. Don't post in all caps. It's rude unless you are posting old FORTRAN code
  2. If you want to earm vb, don't learn vb6 (from your tag). Pick a new version
  3. Google "vb.net tutorials" instead of asking us to do it for you
rproffitt commented: First college programming course was Fortran and PL/1. Punch cards. Today folk thought we did battle with cards. +15
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'll also mention that if you post code here it stays here. If you link to code on another site and that site, or the post goes away then this thread becomes useless.

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

RE Canasta - I left out the best reason. It's platform independent. You can play it on any type of table, or even on the floor ^_^

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

It also makes it possible to (in some cases) copy/paste code if someone wants to do local testing to help you out.