Bagikan melalui


ADDBS( ) Function

Adds a backslash (if needed) to a path expression.

ADDBS(cPath)

Return Values

Character

Parameters

  • cPath
    Specifies the path name to which to add the backslash.

Example

The following code creates a form that allows entry of a directory path and converts that entry to a fully-qualified pathname using the ADDBS() function.

PUBLIC ofrmADDBS

ofrmADDBS=NEWOBJECT("frmADDBS")
ofrmADDBS.Show
RETURN

DEFINE CLASS frmADDBS AS form

   Top = 0
   Left = 0
   Height = 200
   Width = 353
   Caption = "frmADDBS"
   Name = "frmADDBS"

   ADD OBJECT txtpath AS textbox WITH ;
      Height = 23, ;
      Left = 8, ;
      TabIndex = 1, ;
      Top = 24, ;
      Width = 328, ;
      Name = "txtPath"

   ADD OBJECT label1 AS label WITH ;
      AutoSize = .T., ;
      Caption = "Enter a path expression:", ;
      Height = 17, ;
      Left = 8, ;
      Top = 4, ;
      Width = 135, ;
      TabIndex = 4, ;
      Name = "Label1"

   ADD OBJECT cmdclose AS commandbutton WITH ;
      Top = 166, ;
      Left = 252, ;
      Height = 27, ;
      Width = 84, ;
      Caption = "Close", ;
      TabIndex = 3, ;
      Name = "cmdClose"

   ADD OBJECT txtaddbspath AS textbox WITH ;
      Height = 23, ;
      Left = 7, ;
      ReadOnly = .T., ;
      TabIndex = 5, ;
      TabStop = .F., ;
      Top = 121, ;
      Width = 328, ;
      Name = "txtADDBSPath"

   ADD OBJECT label2 AS label WITH ;
      AutoSize = .T., ;
      Caption = "The same expression after ADDBS()", ;
      Height = 17, ;
      Left = 7, ;
      Top = 101, ;
      Width = 201, ;
      TabIndex = 6, ;
      Name = "Label2"

   ADD OBJECT cmdapplyaddbs AS commandbutton WITH ;
      Top = 60, ;
      Left = 216, ;
      Height = 27, ;
      Width = 120, ;
      Caption = "Apply ADDBS()", ;
      TabIndex = 2, ;
      Name = "cmdApplyADDBS"

   PROCEDURE cmdclose.Click
      THISFORM.Release()
   ENDPROC

   PROCEDURE cmdapplyaddbs.Click
      THISFORM.txtADDBSPath.Value=ADDBS(ALLTRIM(THISFORM.txtPath.Value))
      THISFORM.Refresh()
   ENDPROC

ENDDEFINE

See Also

DEFAULTEXT( ) | FILE( ) | FORCEEXT( ) | FORCEPATH( ) | JUSTDRIVE( ) | JUSTEXT( ) | JUSTFNAME( ) | JUSTPATH( ) | JUSTSTEM( )