0

I am developing a billing system using PowerBuilder 12.5 Classic and I need to set 0 for a textbox; like in vb.net txtchange.Text = 0
i have two drop down list boxes

  1. ddlb_price (defines the price value of an item)
  2. ddlb_cash (the cash amount given by the customer)
  3. sle_change (the change that the cashier is to give the customer)

the system should set the value for sle_change when the cashier inputs the cash.
1. this gives me syntax error;

if cash=price then
    sle_fare.settext=0
   end if


2. this gives 'incompatible types in assinment

    if cash=price then
      sle_fare.text=0
    end if
Terry
  • 6,160
  • 17
  • 16
Wepex
  • 163
  • 4
  • 13
  • 32

2 Answers2

4

The single line edit (sle) control is designed to hold text. You're trying to assign it a numeric value. You will have to change the number into a string if you want the sle to display it:

sle_fare.text = "0" 

or

sle_fare.text = string(variableHere) 
Slapout
  • 3,759
  • 5
  • 40
  • 61
1

Once again, I'm going to step back, ignore the actual questions, and look at how a DataWindow would help as an alternative.

You seem to want a control with a data type behind it. The DataWindow has those types of controls. Don't forget that a DataWindow doesn't have to have a SELECT statement behind it; it can have a stored procedure, web service, or nothing at all (external DataWindow) behind the data set. Once you have a control with a numeric data type behind it, you get (for free) some basic editing controls, such as not allowing alpha characters in the field and making sure the entered value is really a number (e.g. "0-.2.1" would fail).

A step beyond that is looking at one of your coming requirements: calculating change. On a DataWindow, you can create a compute with an expression that will automagically calculate your change for you, once price and cash are entered.

I certainly don't want to say you can't do things the way you're proceeding, but there are many issues that a DataWindow would remove over some other approach. The strength of PowerBuilder is in the DataWindow.

Good luck,

Terry

Community
  • 1
  • 1
Terry
  • 6,160
  • 17
  • 16