Eternal Newbie 30 Newbie Poster

Oh friend, that was a simple one. Here's a help:

CloseButton.Anchor = AnchorStyles.Top + AnchorStyles.Right
Eternal Newbie 30 Newbie Poster

I checked briefly through your code and the problem seemed to be that diskDestination.
I'm not sure since I'm not a pro. In my point of view, HTML is not only a file, it contains many objects and they're in a folder. Then when you creating a file but not a file and a folder, things might not working your way.

        Try
            Dim selectedReport As New ReportClass
            Dim CrFormatTypeOptions As New HTMLFormatOptions
            CrFormatTypeOptions.HTMLBaseFolderName = "d:\test"
            CrFormatTypeOptions.HTMLFileName = "htmlformat.htm"
            Dim CrExportOptions As ExportOptions
            CrExportOptions = myReportDocument.ExportOptions
            With CrExportOptions
                .ExportFormatType = ExportFormatType.HTML40
                .FormatOptions = CrFormatTypeOptions
            End With
            myReportDocument.Export()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
Eternal Newbie 30 Newbie Poster

I tested your code and it was right. But, somehow, your ds did not change during run time and it makes your combobox couldn't change, too.
My recommendation: Place your combobox loading sub on some where it continually checking SQL and update a new dataset when your SQL table change.
Hope this help.

Eternal Newbie 30 Newbie Poster

Happy to see someone's learning new things in VB.Net. I changed the code so you can understand it better:

        For Each ci As String In CheckedListBox1.Items
            If ci.Trim Like Ftxt.Trim Then
                MsgBox(ci)
            End If
        Next
Eternal Newbie 30 Newbie Poster

Here's a code of mine, almost solving the same problem as yours:

        If TextBox1.Text <> "" Then
            Ftxt = TextBox1.Text
            For i As Integer = 0 To Me.CheckedListBox1.Items.Count - 1
                If CheckedListBox1.Items(i).ToString.Trim = Ftxt.Trim Then
                    CheckedListBox1.SetItemChecked(i, True)
                End If
            Next
        End If
Eternal Newbie 30 Newbie Poster

I believe .FileName in Vb.Net is a name with a path, but that doesn't matter. If you couldn't use For Each then For Next, and if you have a .FileNam then remove the path. Here's your code then, since it finished, mark this question as solved if you found your answer:

        Dim Path As String = "Your Path Here, with a "\" at the end"
        Dim file() As String = Directory.GetFiles(Path.Trim, "*.txt")
        For i As Integer = 0 To file.Length - 1
            Dim SMSdtl As String
            Dim txtReader As New System.IO.StreamReader(file(i))
            Do While txtReader.Peek() <> -1
                SMSdtl = txtReader.ReadToEnd.ToString.Trim
            Loop
            TextBox4.Text = SMSdtl.ToString.Trim
            TextBox1.Text = file(i).Replace(Path.Trim, "").Trim
        Next
Eternal Newbie 30 Newbie Poster

Actually it's quite simple.
The f in the those code lines is itself a .Filename, so you only need to fill f to your TextBox3, SMS information into TextBox4. I'll give you some hints to make it easier, it'll work right away but might need some fixes to avoid marginal errors.

Dim f As String() = Directory.GetFiles("YourTextFilesPath", "*.txt")
For Each f In f()
    Dim SMSdtl As String
    Dim txtReader As New System.IO.StreamReader(f)
    Do While txtReader.Peek() <> -1
            SMSdtl = SMSdtl & txtReader.ReadLine() & vbNewLine
    Loop
    Textbox3.Text = f
    Textbox4.Text = SMSdtl
Next
Eternal Newbie 30 Newbie Poster

I'll help change your button2 then:

 Dim f As String() = Directory.GetFiles("YourTextFilesPath", "*.txt")
 For Each dir In dirs
     ...
     'Do anything you want with f.FileName
     ...
 Next
Eternal Newbie 30 Newbie Poster

For every types of file or for excel, use:
Process.Start(FilePath.Trim"\"+Filename.Trim+".xls")

Eternal Newbie 30 Newbie Poster

We don't do print to form in VB.Net, but I can suggest some objects like ReportViewer. In my case, I prefer using CrystalReport so I'm using CrystalReportViewer quite often, it show a copy of what you are going to print and even let you save your printing to .doc,.pdf or .xls.

Eternal Newbie 30 Newbie Poster

Try this:

yDTable.Columns("IndexChangeColName").SetOrdinal(IndexYouWantingToChangeTo)

I'm not sure about this, but this will change the position of your column and is there're multiple columns to change - like n columns, etc... - you must use this line n times to change all the columns' position.

yDTable.Columns("IndexChangeColName(1)").SetOrdinal(IndexYouWantingToChangeTo(1))
....
yDTable.Columns("IndexChangeColName(n)").SetOrdinal(IndexYouWantingToChangeTo(n))
Eternal Newbie 30 Newbie Poster

@nashy: You welcome :)

Eternal Newbie 30 Newbie Poster

My solution is: Creating an array of buttons with your buttons then loop through it together with your SQL columns.

Eternal Newbie 30 Newbie Poster

Here's your code:

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.Text = TextBox1.Text.ToUpper()
    End Sub
Begginnerdev commented: Correct! +8
Eternal Newbie 30 Newbie Poster

'e' values stands for '10' in Decimal, jusy say: a kind of mathematics symbol. For example: Double says: "e", Decimal says "10"... Btw, I'm also a newbie then learning things also feeling good for me.

Eternal Newbie 30 Newbie Poster
  1. It could be the string length (in VB) was longer than the field size (in SQL).
  2. It could be the string returned a NULL value and could not be accpect by SQL.
  3. It could be the LINQ string exceeded max length for a SQL execute string (5000).
Eternal Newbie 30 Newbie Poster

I agree with Begginnerdev, since Int32 is normal interger, Int16 is "Short" interger, Int64 is "Long" interger.

Eternal Newbie 30 Newbie Poster

@Don,
Double show 'e' values when Decimal not (so, not everything is "number"). Someone told me to use Decimal when coding accounting projects and Double for mathmatics ones, not really know the reason.

Eternal Newbie 30 Newbie Poster

I suggest that your 'stateSlsTax' has not been set as Decimal, try this code instead:

        Dim stateSlsTax As Decimal
        stateSlsTax = Convert.ToDecimal(txbStateTaxPcnt.Text)
        txbStateTaxPcnt.Text = stateSlsTax.ToString("n2")

If this one not working corectly, I think you should check if there are any '.Trim()' things around your code.

Eternal Newbie 30 Newbie Poster

Just use ToDecimal(). Works everytime.

Eternal Newbie 30 Newbie Poster

Well, CInt with a string is not possible. Try CChar(), or replace ".grand_total " with some Int value.

Eternal Newbie 30 Newbie Poster

I think it probably the same. You can change "Ct='abc'" with your query and "Ct" with your sorting column.

        Dim Dr() As DataRow
        Dr = dt.Select("ct = 'abc'", "ct")
        For i As Integer = 0 To Dr.Length - 1
            dt.Rows.Remove(Dr(i))
        Next
Eternal Newbie 30 Newbie Poster

How' bout set WindowState to Maximized?

Form1.WindowState = FormWindowState.Maximized
Eternal Newbie 30 Newbie Poster

May you try:

dt.AcceptChanges()
dt.Rows.Remove(row)

With 'row' is the row which you want to remove.