2 Replies - 459 Views - Last Post: 06 October 2012 - 09:02 AM Rate Topic: -----

#1 zox  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 06-October 12

6 errors converted from c#

Posted 06 October 2012 - 08:38 AM

Hi,

i get 6 errors, i converted code like i say in topic.

here is the code

        Private Sub button3_Click(ByVal sender As Object, ByVal e As EventArgs)
            Dim printerGlavni As String = Util.Opcije.PrinterGlavni
            If printerGlavni = "FIS" Then
                Dim textWriter As TextWriter = New StreamWriter("C:\fiskal\print.inp")
                Dim text As String = "79,1,______,_,__;"
                Dim text2 As String = Me.maskedTextBox1.Text.Substring(0, 2) + Me.maskedTextBox1.Text.Substring(3, 2) + Me.maskedTextBox1.Text.Substring(8, 2)
                Dim text3 As String = Me.maskedTextBox2.Text.Substring(0, 2) + Me.maskedTextBox2.Text.Substring(3, 2) + Me.maskedTextBox1.Text.Substring(8, 2)
				text = String.Concat(New String()() = { text, text2, ";", text3, ";" })
                textWriter.WriteLine(text)
                textWriter.Close()
            Else
                If printerGlavni = "TRM" Then
					Dim text2 As String = String.Concat(New String()() = { Me.maskedTextBox1.Text.Substring(6, 4), "-", Me.maskedTextBox1.Text.Substring(3, 2), "-", Me.maskedTextBox1.Text.Substring(0, 2) })
					Dim text3 As String = String.Concat(New String()() = { Me.maskedTextBox2.Text.Substring(6, 4), "-", Me.maskedTextBox2.Text.Substring(3, 2), "-", Me.maskedTextBox2.Text.Substring(0, 2) })
                    Dim xmlTextWriter As XmlTextWriter = New XmlTextWriter("C:\fiskal\report.xml", Encoding.UTF8)
                    xmlTextWriter.WriteStartDocument(True)
                    xmlTextWriter.WriteStartElement("TremolFpServer")
                    xmlTextWriter.WriteStartAttribute("Command")
                    xmlTextWriter.WriteString("Report")
                    xmlTextWriter.WriteStartAttribute("Type")
                    xmlTextWriter.WriteString("Date")
                    xmlTextWriter.WriteStartAttribute("Start")
                    xmlTextWriter.WriteString(text2)
                    xmlTextWriter.WriteStartAttribute("End")
                    xmlTextWriter.WriteString(text3)
                    xmlTextWriter.WriteEndAttribute()
                    xmlTextWriter.WriteEndElement()
                    xmlTextWriter.Flush()
                    xmlTextWriter.Close()
                End If
            End If
        End Sub



first error is: '{' expected. on line 8 ( = )
second error is: Comma, ')', or a valid expression continuation expected. on line 8 ( } )
3-th error is: '{' expected. on line 13 ( = )
4-th error is: Identifier expected. on line 13 ( "-" )
5 and 6 error is: like 3 and 4 on line 14

how to fix that errors?


Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: 6 errors converted from c#

#2 dotINSolution  Icon User is offline

  • New D.I.C Head

Reputation: 6
  • View blog
  • Posts: 16
  • Joined: 25-September 12

Re: 6 errors converted from c#

Posted 06 October 2012 - 08:45 AM

Here's the fixed code:
 Private Sub button3_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim printerGlavni As String = Util.Opcije.PrinterGlavni
        If printerGlavni = "FIS" Then
            Dim textWriter As TextWriter = New StreamWriter("C:\fiskal\print.inp")
            Dim text As String = "79,1,______,_,__;"
            Dim text2 As String = Me.maskedTextBox1.Text.Substring(0, 2) + Me.maskedTextBox1.Text.Substring(3, 2) + Me.maskedTextBox1.Text.Substring(8, 2)
            Dim text3 As String = Me.maskedTextBox2.Text.Substring(0, 2) + Me.maskedTextBox2.Text.Substring(3, 2) + Me.maskedTextBox1.Text.Substring(8, 2)
            text = String.Concat(New String() {text, text2, ";", text3, ";"})
            textWriter.WriteLine(text)
            textWriter.Close()
        Else
            If printerGlavni = "TRM" Then
                Dim text2 As String = String.Concat(New String() {Me.maskedTextBox1.Text.Substring(6, 4), "-", Me.maskedTextBox1.Text.Substring(3, 2), "-", Me.maskedTextBox1.Text.Substring(0, 2)})
                Dim text3 As String = String.Concat(New String() {Me.maskedTextBox2.Text.Substring(6, 4), "-", Me.maskedTextBox2.Text.Substring(3, 2), "-", Me.maskedTextBox2.Text.Substring(0, 2)})
                Dim xmlTextWriter As XmlTextWriter = New XmlTextWriter("C:\fiskal\report.xml", System.Text.Encoding.UTF8)
                xmlTextWriter.WriteStartDocument(True)
                xmlTextWriter.WriteStartElement("TremolFpServer")
                xmlTextWriter.WriteStartAttribute("Command")
                xmlTextWriter.WriteString("Report")
                xmlTextWriter.WriteStartAttribute("Type")
                xmlTextWriter.WriteString("Date")
                xmlTextWriter.WriteStartAttribute("Start")
                xmlTextWriter.WriteString(text2)
                xmlTextWriter.WriteStartAttribute("End")
                xmlTextWriter.WriteString(text3)
                xmlTextWriter.WriteEndAttribute()
                xmlTextWriter.WriteEndElement()
                xmlTextWriter.Flush()
                xmlTextWriter.Close()
            End If
        End If
    End Sub



Don't forget to import following:
[code]Imports System.IO
Imports System.Xml/code]

Also, you must be having those 2 masked Textboxes in your application.
Was This Post Helpful? 0
  • +
  • -

#3 zox  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 06-October 12

Re: 6 errors converted from c#

Posted 06 October 2012 - 09:02 AM

i have already imported.

Thanks for fast answer.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1