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

Then unless the /console option is still available, the built in remote desktop is likely not an option. Unfortunately I am at the cottage and cannot check it out. I have only the one computer here.

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

My original point was that I think Python is an excellent language that, if I had been aware of it twelve years ago, I would have used instead of vbScript. It would have saved me countless hours of development. I think it is an excellent language for beginners as well as seasoned professionals. My second point was that unless you are willing to pay for something like QT, developing a GUI based app in Python can be daunting. At least that was the case for me.

You seem to feel that VB apps are to be frowned upon. I fail to see why a well written application in any language should be looked down upon. I believe Sturgeon's Law still holds. Ninety percent of everything is crap. That applies equally to VB, C, C++, even Python. Blame the programmer, not the platform.

In any case, we are probably getting off topic.

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

The only GUI development I have done using Python was with either wxPython or Tkinter. I may be mistaken but I believe you have to by QT, whereas Visual Studio Express is free. The first actual GUI app I developed was a Load Advisory Program for our control centre (in C under OS/2). No tools, and all GUI elements had to be coded by hand. It was brutal. In my opinion, the tools you use to develop programs are at least as important as the underlying language. Few would be developing VB.net apps with GUIs without using an environment that removes the grunt work of placing visual elements, or an interactive debugger that supports breakpoints and step-by-step source level debugging.

Nice to see you back. I hope the move went well.

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

@Habitual - sugar gliders. Hmm. Aussie?

Two cats at the moment. In 30 years we've had three Irish Setters, one Shepherd/Husky cross and two cats other than the current ones.

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

I started scripting around the year 2000. I had been a professional programmer for around 25 years. None of my code required a user interface and the ability to inspect/modify code at three in the morning was critical so vbScript filled the bill. It was free and required no special IDE. Had I known about Python at the time I might have used it instead of vbScript. Using Python as implemented today I could have cut my programming time in half and my consumption of antacids by even more.

However, that was because my apps required no GUI. Developing apps in Python requiring a GUI is painful in the extreme. Using wxPython, everything must be done by hand and little of it is intuitive. Developing a GUI in VB.net on the other hand is almost trivial in comparison.

Based on my experience, Python is an outstanding first language and it maintains its appeal even to veteran programmers. But if your goal is to develop any kind of serious GUI, be prepared to invest a lot of time in learning details which you should not have to be concerned about.

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

The following will implement the formula, however, it won't give you the result you want unless you convert the angle from degrees to radians. The following code does that by multiplying the angle by PI/180. I'll assume the formula is correct (trig was never my strong suit).

Imports System.Math

Public Class Form1

    '                       dia           1          dia
    'h   =   sh * s  +  ------------   +  -  *   ------------
    '                   2 * tan(ang)      3      2 * tan(ang1)

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

        Dim sh As Double = CDbl(txtsh.Text)
        Dim s As Double = CDbl(txts.Text)
        Dim dia As Double = CDbl(txtdia.Text)
        Dim ang As Double = CDbl(txtang.Text) * PI / 180.0
        Dim ang1 As Double = CDbl(txtang1.Text) * PI / 180.0

        Dim h As Double

        h = sh * s _
          + dia / (2.0 * Tan(ang)) _
          + dia / (2.0 * Tan(ang1) / 3.0)

        txth.Text = h

    End Sub

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

When I did 24x7 support for our control centre I used Dameware. They had a remote viewer/desktop that could be pushed from the client (me) to the remote desktop on demand. VNC required the prior installation of host software. Of course, both packages require you to have appropriate access rights. I was the sysadmin so I could pretty much do anything. The built in remote desktop (mstsc.exe) might fit the bill but if you have to connect through firewalls there might be config problems. The options for mstsc have changed since Windows XP. There used to be a /console switch that allowed you to connect to the current session. I don't see it in the switches (/?) anymore. Also, it may not be possible to connect to a remote session without blanking the screen of that session. What version of Windows is running on the client and remote machines?

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

Based on your reasoning (avoiding hard coded width), can you please explain why you recommend against

mynum.ToString(StrDup(width,"0"))

which does not have a hard coded width? Is there a reason that

New String("0"c,width)

is preferable to

mynum.ToString(StrDup(width,"0"))
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's always a good idea to state specifically what you are trying to do. What you have done is say that you are trying to do some math, then shown us uncommented code. Having said that, I would use double rather than decimal.

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

Anyone ever notice in Castle that Beckett wears high heels, but when there is a chase scene her shoes mysteriously change to no-heels?

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

I suspect it is one of those applications that takes highly specialized knowledge. It would be like asking someone with highschool math to solve linear diophantine equations or calculate eigen values.

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

Typically when you want to format an integer with leading zeroes the field width is known beforehand. In that case you can hardcode the width as

mynum.ToString("00000")

which will give you a five digit integer with leading zeroes. More generally you can code

mynum.ToString(StrDup(width,"0"))

where "width" can vary at runtime.

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

How many items do you have in your datagrid and what do you define as "slow"? How long is it taking to complete the loop? Do you get consistent times on successive runs? Do you have anything else running that could be sucking back CPU cycles?

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

If you are using SQLEXPRESS on your PC you can use ".\SQLEXPRESS" for SERVERNAME. For DATABASE you'll plug in the name of the database as used by SQL Server (not the file name).

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

The following code connects to the mydb database on my local copy of SQLEXPRESS.

Dim conn As New SqlClient.SqlConnection
'conn.ConnectionString = "Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;"
conn.ConnectionString = "Data Source=" & SERVER & " ;Initial Catalog=" & DATABASE & ";Integrated Security=SSPI;"

conn.Open()
MsgBox(conn.State)

It uses integrated security (based on your windows logon). If you have to provide a SQL username and password then use the commented out form. A Complete reference for various connection strings can be found here

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

Thr following code assumes integer values in columns 0 and 1 of a datagridview. It calculates column0 + column1 and puts the result in column2. Use CDbl for floating point values. To calculate the total sum just keep a running total of the values in column2

For Each row As DataGridViewRow In DataGridView1.Rows
    row.Cells(2).Value = CInt(row.Cells(0).Value) + CInt(row.Cells(1).Value)
Next
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Print the value of qr, then post the results here along with the "problem" you are having. I presume some sort of syntax error?

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

Can you give us an example of what you are trying to do? Can you list a simple case with the contents of two comboboxes and what you want to see as a result?

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

You're from Winnipeg as well? My wife and I spend 4+ months at the cottage. I usually make a drive back mid summer for a week or so around my Mom's birthday to check on the house, do banking, etc. This year (mostly because of the dog) I decided to come back on Father's Day. Gonna spend Father's Day with #2 son and also get (got, actually, he's here now) a dog. What part of Winnipeg claims you? I'm in Transcona myself but originally from North Kildonan. I just looked at your bio and saw the "public utilities" part. Not Manitoba Hydro by chance? I worked there for 29 years.

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

If they can't run it without providing a serial number then your software is protected. However, like much commercial software, even providing a serial number is not protection against illegal use because there is nothing to prevent one user from sharing the serial number. It gets tricky.

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

I don't know how to request a serial number while installing, but wouldn't it be sufficient to ask for the serial number when the application runs? If the serial number is incorrect or not entered you can always exit the application.

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

Drove from Shebandowan Lake to Wininipeg to pick up an Irish Setter. It's a five-year old who needs a good home and we have been without a dog for the last few months (the first time in 30 year). While driving (7 hours trip) I listened to Stories From the Vinyl Cafe by Stuart MacLean.

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

A better way to iterate over a set of particular controls is

For Each tb As TextBox In Me.Controls.OfType(Of TextBox)()
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Semantics.

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

What data are you trying to save and do you have a particular form you want to use (text file, per user settings etc). Are you trying to save the controls themselves for later use or just the data in those controls? If just the data, what do you want to do with that data? Will it be reloaded when the app is rerun?

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

Always great to see a new face. Especially one from the IT trenches. Welcome aboard.

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

I tried your code (after adding the control to the form) and it worked just fine. Newline and paste worked as expected. What version of VB are you using?

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

The OP asked about msconfig settings so I based my answer on that. msconfig is not merely a diagnostic tool. It can be used to enable/disable programs to start automatically. It can also be used to disable the default "idiot light" display at startup. I like to see drivers identified as they are loaded. Msconfig lets me set that option. There are other tools that do thiss better (autoruns from SysInternals, for example), but again, the OP asked about msconfig.

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

I suggest you just use the CopyFile method of the Scripting.FileSystemObject. It has two forms

fso.CopyFile srcefile,destfile
fso.CopyFile srcefile,destpath

If the second parameter ends in "\" then it assumes form 2 and copies the file to the given folder otherwise it copies the file to the given destination file. Eighty percent or so of the scripts I wrote between 1998 and 2008 did some sort of file copy as part of the processing and except for the very few that used FTP, I always used the builtin file copy methods. Almost all of the code I wrote in that period was vbScript.

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

There is a checkbox on the Boot tab that says "Make all boot settings permanent". Have you tried selecting that? What settings are you trying to make permanent? What exactly do you mean by "all that crap"?

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

The short answer is yes. If you provide more information then perhaps a longer answer would be possible.

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

Can you clarify

However wrapping occurs (ie) when I finish the like till the end

The code you show to create the RichTextBox is incomplete so it is hard to give an informed answer. There should be no way to access the created control(s) through the GUI because you haven't added the new control to the form. I assume this code exists elsewhere. If so then you should include it in your posting.

You should also declare c as the correct control type as in

Dim c As New RichTextBox
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

And never use field names that contain spaces. You have one field named "Type of License". You could use the spaces if you referenced the field by [Type of License] but embedding spaces is just bad form. Remove the spaces and you should be OK.

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

The following will add "some text" to the combo box only if it doesn't already exist.

Dim text As String = "some text"

If Not ComboBox1.Items.Contains(text) Then
    ComboBox1.Items.Add(text)
End If
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In that case use

file_name.LastIndexOf("\bin")) & "\" & EIDCardNr.Text & "."
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You could use consts and index with those instead of literals as in

    Const JAN = 1
    Const FEB = 2
    Const MAR = 3
    .
    .
    .
    Const TOTAL = 13
    .
    .
    .
    DataGridView1.Rows(3).Cells(JAN).Value = etc
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Assuming you have the card number stored in a variable named EIDCardNo, just replace your line

file_name.LastIndexOf("\bin")) & "\test."

with

file_name.LastIndexOf("\bin")) & "\" & EIDCardNo & "."
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Some religious people wear their belief on their sleeves and never miss an opportunity to proselytize. There are atheists who do the same. I've coined a word for a person who doubts the existence of God and won't shut up about it.

nagnostic

Think it'll catch on?

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

Glad to be of help. Please remember to mark this thread as solved if it works out for you.

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

Hard to give a definite answer without a few specifics. I don't see how you are doinig the file copy. You declare a FileSystemObject but you don't use the CopyFile method of that object. I don't know the values of $URL or the destination path. As far as I know, $FileCopy and $GetAppPath are not part of vbScript. What access rights do you have on the remote server? Is the server on the same LAN?

You use fso.GetFile and return a file object in f but you don't use f for anything.

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

Most of my database experience has been in real-time processing where getting the data into the database was the most important step. Displaying the data was secondary because of processes downstream that required access to current data. In my case I was dealing with more than 8000 records at a time. My preference would be to insert the records into the database first, then populate the datagridview via a query to fetch the most recent records from the database.

I should add that my database inserts were done, for speed reasons, using the SQL bulk insert capability - something which is not available (as far as I know) in Access. Incidentally, when you ran your timing tests, did you use SuspendLayout and ResumeLayout? Doing a suspend before adding the records, then resume following would speed up the process by stopping the control from updating until all the records have been added.

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

Testing attach of two image files. Well bite me. Now if works. Here's the two files.

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

I would very much like to attach the two sample pictures but for some reason I cannot. Trust me. The first picture has columns headers and the second one does not.

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

I created a DataGridView and added four columns. I copied your sample input into d:\temp\testdata.txt and ran the following code:

Public Class Form1

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

        For Each line As String In System.IO.File.ReadAllLines("d:\temp\testdata.txt")
            DataGridView1.Rows.Add(line.Split(","))
        Next

    End Sub

End Class

If ColumnHeadersVisible is set to True you get the output in attachment 1. If False you get attachment 2.

poojavb commented: perfect...short and simple +4
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you want to use the format you gave in the OP you just have to convert the embedded double quotes to double double quotes as follows

code= " <meta http-equiv=""Content-Type"" content=""text/html; charset=windows-1254""> "

I may be mistaken on this but you also may be able to replace the embedded quotes with single quotes as in

code= " <meta http-equiv='Content-Type' content='text/html; charset=windows-1254'> "
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I had a similar problem recently. While at the cabin I connect via a Roger's wireless Rocket Hub. The hub came configured to use 8.8.8.8 as both the primary and backup DNS. From the command line, when I typed

ping 8.8.8.8

I got no response. When I reset the two entries to 208.67.222.222 and 208.67.220.220 (OpenDNS) I was able to browse once again. Forgive me if I insult your level of knowledge, but for the sake of clarity (and for any noobs who might be looking for a solution), a DNS is basically a computer somewhere on the internet, that takes named addresses such as "www.google.com" and returns the actual numeric (IP) address such as 173.194.75.105. If the DNS is unavailable (as it was in my case), or your computer (or router) is not configured properly your browser will not be able to convert names to addresses.

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

From back in the 80s, Pascal Languirand - De Harmonia Universalia

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

If you just want to index by number and you know how many items there are in the list then you can just use an array as in

Dim allelements As HtmlElementCollection = MbFacebookBrowser.Document.GetElementsByTagName("span")
Dim labels(3) As String
Dim item As Integer = 0

For Each DD As HtmlElement In allelements
    If DD.OuterHtml.Contains("resource") Then
        TlsResourceComboBox.Items.Add(DD.GetAttribute("InnerText"))
        labels(item) = DD.GetAttribute("InnerText"))
        item += 1
    End If
Next

LblHel.Text = labels(0)
LblIro.Text = labels(1)
LblOxy.Text = labels(2)
LblWat.Text = labels(3)

'this will crash if there are more than four "resource" elements
'you could also do

Dim allelements As HtmlElementCollection = MbFacebookBrowser.Document.GetElementsByTagName("span")
Dim item As Integer = 0

For Each DD As HtmlElement In allelements

    If DD.OuterHtml.Contains("resource") Then

        TlsResourceComboBox.Items.Add(DD.GetAttribute("InnerText"))

        Select Case item
            Case 0: LblHel.Text = DD.GetAttribute("InnerText"))
            Case 1: LblIro.Text = DD.GetAttribute("InnerText"))
            Case 2: LblOxy.Text = DD.GetAttribute("InnerText"))
            Case 3: LblWat.Text = DD.GetAttribute("InnerText"))
        End Select

        item += 1

    End If

Next

'that would ignore any additional resource elements
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can use a Dictionary to store things. A Dictionary consists of name/value pairs where the name is used as the index (key). The value part can be of any type, even objects and custom classes. When you create a dictionary object you declare the type of the key and value as follows

Dim mydict As New Dictionary(Of <type>, <type>)

For example you could declare a dictionary to hole employee names keyed by employee number as follows:

Dim empdict As New Dictionary(Of Integer, String)

and you would add entries as

empdict.Add(1024, "Jetson, George")

You can access the values as

Msgbox(empdict(1024))

Check out the documentation for all the features.

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

You might want to have a look at the free log parser tool from Microsoft which can be downloaded here

|-|x commented: looks like this will do what I need. thx +6