Bmorewize
Bmorewize

Reputation: 49

Modifying a Read-Only Text Box

I am trying to create a form that on the load, an input box appears so that I can input a stock number. From there, I want to take the stock number and have it appear as a read-only text box on the form. After that, I want that user to be able to press a button that they can enter another stock number. The problem that I am having is that when I click the button that will allow you to enter another stock number, the form does not update with the new information. I know what I am missing something, but I can not put my finger on it. Any help would be greatly appreciated.

This happens on the load

    Private Sub Contract_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    DocName = C1Report1.Document.DocumentName

    Me.btnPrint.Focus()
    Me.Text = DocName & " - " & DealID
    Try
        Try
            mFormInfo = SetValues(DocName, Me, DealID)
        Catch
        End Try
        myDeal = Infinity.Finance.Calc.Deal.GetDealNumber(DealID)
        myFinance = Infinity.Entity.TotalEntity.GetEntity(myDeal.FinanceCompany)
        myVeh = Infinity.Vehicle.Inventory.VehicleUnit.GetVehicleUnit(myDeal.DealVehicles(0).VehID)
        myDealership = Infinity.CompanyInfo.Company.GetCompany(myDeal.CompanyNumber)
        Dim StkNumber As String = InputBox("Please Enter Stock Number", DocName & " - " & DealID, UltraTextEditor22.Text)
        StkNumber = UltraTextEditor22.Text
        UltraTextEditor22.ReadOnly = True

    Catch
    End Try
    'GetaccesoriesFromObject()
End Sub

Step 1

Step 2

Step 3

This is the event for the button click

    Private Sub btnNewStockNum_Click(sender As Object, e As EventArgs) Handles btnNewStockNum.Click
    UltraTextEditor22.Clear()
    Dim NewStkNumber As String = InputBox("Please Enter Stock Number", DocName & " - " & DealID, UltraTextEditor22.Text)
    NewStkNumber = UltraTextEditor22.Text
    UltraTextEditor22.ReadOnly = True
End Sub

Upvotes: 0

Views: 95

Answers (1)

NoAlias
NoAlias

Reputation: 9193

You are setting the value of the variable that retrieves the input from the user to the value of the textbox. You need to do the opposite of that:

Dim NewStkNumber As String = InputBox("Please Enter Stock Number", DocName & " - " & DealID, UltraTextEditor22.Text)
UltraTextEditor22.Text = NewStkNumber

Upvotes: 2

Related Questions