Padleft is not a member of char error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Michelle Monty
    New Member
    • Oct 2007
    • 24

    Padleft is not a member of char error

    Hello, I'm creating a program that will allow the user to enter payment information on the form and it will save that information to a sequential file. I'm getting an error that says 'padleft is not a member of char' on the line that I have *** in front of below. Can someone help me fix this error? I don't know what that error means. Thanks!!

    [CODE=vbnet]Public Class Form1
    Private Const paymentfile As String = "C:\checkfile.t xt"
    Private _checknumber As String
    Private _checkdate As Date
    Private _payee As String
    Private _checkamount As Decimal
    Public Property checknumber() As String
    Get
    Return _checknumber
    End Get
    Set(ByVal value As String)
    _checknumber = value
    End Set
    End Property
    Public Property checkdate() As Date
    Get
    Return _checkdate
    End Get
    Set(ByVal value As Date)
    _checkdate = value
    End Set
    End Property
    Public Property payee() As String
    Get
    Return _payee
    End Get
    Set(ByVal value As String)
    _payee = value
    End Set
    End Property
    Public Property checkamount() As Decimal
    Get
    Return _checkamount
    End Get
    Set(ByVal value As Decimal)
    _checkamount = value
    End Set
    End Property

    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
    Me.Close()
    End Sub

    Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button2.Click
    Dim path As String = "C:\documen ts and settings\tammy and rich\my documents\visua l studio 2005\projects\f ranklin calendars\"


    Dim ourcheck As New Object

    Dim payment As Object

    Dim newlineindex As Integer
    Dim recordindex As Integer
    If checknumbertext box.Text <> String.Empty AndAlso checkdatetextbo x.Text <> String.Empty AndAlso payeetextbox.Te xt <> String.Empty AndAlso checkamounttext box.Text <> String.Empty Then
    ourcheck.checkn umber = checknumbertext box.Text
    newlineindex = Text.IndexOf(Co ntrolChars.NewL ine, recordindex)


    ****** My.Computer.Fil eSystem.WriteAl lText(path & "paymentfile.tx t", ourcheck.checkn umber.PadRight( 20) & ourcheck.checkd ate.ToString.Pa dLeft(10) & ourcheck.payee. ToString.PadLef t(10) & ourcheck.checka mount.ToString( "N2").PadLeft(1 0), True)
    checknumbertext box.Text = String.Empty
    checkdatetextbo x.Text = String.Empty
    payeetextbox.Te xt = String.Empty
    checkamounttext box.Text = String.Empty
    End If

    checknumbertext box.Focus()
    End Sub

    End Class[/CODE]
    Last edited by Shashi Sadasivan; Dec 5 '07, 04:42 AM. Reason: adding code tags
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Hmm
    [code=vbnet]
    ourcheck.checka mount.ToString( "N2").PadLeft(1 0)
    [/code]
    Seems like a valid statement to me?

    Maybe try this:
    [code=vbnet]
    (ourcheck.check amount.ToString ("N2")).PadLeft (10)
    [/code]

    Comment

    • Michelle Monty
      New Member
      • Oct 2007
      • 24

      #3
      Thanks but nope, still getting the same error.


      Originally posted by Plater
      Hmm
      [code=vbnet]
      ourcheck.checka mount.ToString( "N2").PadLeft(1 0)
      [/code]
      Seems like a valid statement to me?

      Maybe try this:
      [code=vbnet]
      (ourcheck.check amount.ToString ("N2")).PadLeft (10)
      [/code]

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        What is you went more like this, so you can be sure which part is bad:
        [code=vbnet]
        dim writestring as string
        writestring=wri testring &ourcheck.check number.PadRight (20)
        writestring=wri testring &ourcheck.check date.ToString() .PadLeft(10)
        writestring=wri testring &ourcheck.payee .ToString().Pad Left(10)
        writestring=wri testring &ourcheck.check amount.ToString ("N2").PadLeft( 10)
        My.Computer.Fil eSystem.WriteAl lText(path & "paymentfile.tx t", writestring, True)
        [/code]
        When typing this out, I noticed that some of your .ToString()s didn't have the () part, is that some sort of VB thing or are you missing it?

        Comment

        Working...