john.knapp 25 Posting Whiz in Training

Great! If you're all set, mark the question as solved please.

john.knapp 25 Posting Whiz in Training

Use a nested For loop.
please step through this code, I wrote it off the cuff without the IDE, and without testing, it may have undesired "features"

' this will get you started, but you'll need to figure out
' how you're going to handle the rest when you run out of
' straight number to letter substitutions
For i = 0 to 51                             ' only 26 lower and 26 upper
    For char = 65 to 122                    ' ascii values for A-Z, [ \ ] ^ _ `, a-z
        If ((char > 90) AND (char < 97))    ' skip the non-letter characters
            char = 97
        End If
        TextBox4.Text.Replace(i , Chr(char))
    Next
Next
john.knapp 25 Posting Whiz in Training

Stuugie, please mark thread as solved if you're all set.
Thanks

john.knapp 25 Posting Whiz in Training

See your cross-post in the MSSQL forum for the correct query.

Generally speaking, cross-posting is bad etiquette however, and I should have had you move that post to the MSSQL forum at the beginning of the thread. Regardless, adam_k has solved your question.
Please upvote his answer and mark both threads as solved.
Thanks

john.knapp 25 Posting Whiz in Training

You're right - the OP didn't list [Transaction Details]... I had him script the db though, and that table is where the repair status is listed.

Just ran the query and got the requested results. Awesome!
Thanks for your help - I knew SUM() needed to be in there somewhere, but I was missing the CASE statement, which obviously gave me bad results.

Thanks Adam!

john.knapp 25 Posting Whiz in Training

Let me be clear.
By stuck, I mean that with my current level of knowledge I am unable to solve the question.
If anyone in the MSSQL forum would like to jump in, please feel free to do so... :)
Thanks

john.knapp 25 Posting Whiz in Training

As far as I can tell there are no direct equivalents to those particular preprocessor directives. There is an interesting writeup here on using the VB.Net ppd's though.

john.knapp 25 Posting Whiz in Training

[Transaction Details] is the table he wants to pull from anyway, not [Transactions].
I almost have the data, but having trouble with the outer joins/subquery select. (a bit over my head, it's been years since I did any complex queries.

Here's what I have so far:

SELECT     Description.Dgroup AS Description, COUNT(Item.IID) AS TotalCount, [Transaction Details].Ttype
FROM         [Transaction Details] RIGHT OUTER JOIN
                      Item ON [Transaction Details].IID = Item.IID LEFT OUTER JOIN
                      Description ON Item.DeID = Description.DeID
WHERE     (Item.Status IS NULL)
GROUP BY Description.Dgroup, [Transaction Details].Ttype

That query pulls the following:

Description TotalCount  CurrentStatus
Monitor 1   NULL
Object Oriented Programming 1   NULL
Printer 2   NULL
Tower   1   NULL
Printer 1   ItemTransfer
Monitor 1   Releasing
Network Switch  1   Releasing
Printer 1   Releasing
Tower   2   Releasing
USB 1   Releasing
Monitor 1   Repair
Network Switch  1   Repair
Printer 2   Repair

I'm stuck trying to get the repair count from that, while keeping the totalcount

john.knapp 25 Posting Whiz in Training

Almost got it, but returning count of total items under repair for each item... :(
Maybe a UNION SELECT is the way to go - but I'll have to look at it again tomorrow (UTC+5)

SELECT COUNT(Item.SID) as totalcount, Dgroup  as description,
(   SELECT --DGroup, 
      COUNT([Transaction Details].Ttype)
    FROM [Transaction Details]
      INNER JOIN [Item] ON 
        [Transaction Details].IID = Item.IID
      INNER JOIN dbo.Description ON
        [Description].DeID = [Item].DeID
     WHERE [Transaction Details].TType = 'repair'
     --GROUP BY DGroup
 ) As [Under Repair]
FROM dbo.Description INNER JOIN
    dbo.Item ON dbo.Item.DeID = dbo.Description.DeID
WHERE [Item].Status IS NULL
GROUP BY DGroup
john.knapp 25 Posting Whiz in Training

You need sub-queries, one for the totalcount and another for the repair count.
I'm working out the statements now, but I'm rusty... :)

john.knapp 25 Posting Whiz in Training

no attachment?

john.knapp 25 Posting Whiz in Training

Export a script for your database please.
In VS2010, go to server explorer, right-click the server and select publish from context menu

Save, zip, and attach those scripts - make sure you script all objects

john.knapp 25 Posting Whiz in Training

Assuming your character limit is a "hard" stop, the following occurs to me:

  1. Item One: Re-use the same template instead of recreating number(x) templates
  2. Item Two: Make sure you put the bookmark back per previous link
  3. Item Three: Break the text up into "chunks" and send each chunk to a sub-procedure

Off the top code below:

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

        'Fill the textbox first for testing
        Dim myNewLongString As String = vbNullString
        For i = 0 To 9
            myNewLongString = myNewLongString + New String(CChar(CStr(i)), 900)
        Next
        Me.txtOffense1.Text = myNewLongString

        'working variable
        Dim strToChunk As String
        'adjust chunksize as needed
        Dim chunksize As Integer = 900
        'variable to hold textbox character count
        Dim txtlength As Integer = txtOffense1.TextLength
        'how many chunks we talking about?
        Dim numberChunks As Integer = CInt(txtlength / chunksize)
        'create an array to hold the text chunks
        Dim txtchunks(0) As String

        strToChunk = Me.txtOffense1.Text

        If (strToChunk.Length > chunksize) Then
            For i = 0 To numberChunks
                If UBound(txtchunks) < i Then
                    ReDim Preserve txtchunks(i)
                End If
                If strToChunk.Length > chunksize Then
                    txtchunks(i) = Strings.Left(strToChunk, chunksize)
                    strToChunk = strToChunk.Substring(chunksize - 1)
                Else
                    txtchunks(i) = strToChunk
                End If
            Next
        Else ' less than 900 characters in original chunk
            'txtchunks(i) should still be 0 at this point
            txtchunks(0) = strToChunk
        End If

        For i = 0 To UBound(txtchunks)
            SendDataToWord(CStr(txtchunks(i)))
        Next
        ' all done with txtchunks
        Erase txtchunks

    End Sub

    Sub SendDataToWord(stringIn As String)
        ' dummy procedure
    End Sub
mrbungle commented: Great code- thanks! +2
john.knapp 25 Posting Whiz in Training

Do you not need the bookmark after the first insert operation? A quick look online shows me that unless you redefine the bookmark after inserting the text, it's lost.

Can you not just set the page layout for different first page, then let Word decide when to page break?

john.knapp 25 Posting Whiz in Training

There probably is a better way... I don't do drawing code though, so I wouldn't be much help there.

john.knapp 25 Posting Whiz in Training

MSDN documentation for that exception states that it is an exception thrown when an operation is performed on an already disposed object.

A lot of code executes when a form is closed, were you able to trace it to an exact line of code?

john.knapp 25 Posting Whiz in Training

so much syntax, so little brainpower...
Thank you Reverend

john.knapp 25 Posting Whiz in Training

drat - no substr() in VB.Net...
:)

john.knapp 25 Posting Whiz in Training

Run your application in the debugger and step through everything until you know exactly what line throws the exception.

Per MSDN library the 'System.ObjectDisposedException' is defined as:
The exception that is thrown when an operation is performed on a disposed object.

john.knapp 25 Posting Whiz in Training

str = Left(str, str.length -4)

john.knapp 25 Posting Whiz in Training

If you're all set, mark the thread as solved.
Thanks

john.knapp 25 Posting Whiz in Training

This has already been done, and even with 'www.downforeveryoneorjustme.com'. Click Here to see the thread.

By the way, I did a Google search using "vb.net check if website is down" and that was the first hit...

john.knapp 25 Posting Whiz in Training

Google has a custom search API, Click Here for the overview.

What are your specific requirements?
How many websites do you need to be able to view?
How much of each website do you need to "block"?
Is this for a class project, just killing time, or what?

john.knapp 25 Posting Whiz in Training

The Microsoft.Office.Interop.Word namespace is documented on MSDN for Word 2003 and Word 2010 only, so apparently not distributed with any other versions of Office. That said, the Interop assemblies are available for redistribution. The assemblies for Office 2010 are found here: Click Here, I have no idea what will happen if you install and reference those assemblies on a system that has Word 2007 installed, and whatever code you write would have to be isolated by version and tested on a specific basis.

HKLM\Word.Application.CurVer also has the version number on my system (Office 2010), but I don't know whether that key exists in any/all other versions.

Again, it would be helpful to know what versions you need to support.

john.knapp 25 Posting Whiz in Training

Couldn't you check the version and then conditionally branch from there? I found an example here: Click Here. Some sample code to look at might be helpful... By the way, what versions are you trying to support? The original post states Word 2008 and Word 2010, but Word 2008 is in Office 2008 for Mac only as far as I know.