Skip to main content

Autocomplete translation from VB to Extend

  • November 27, 2012
  • 2 replies
  • 0 views

Hello,

Can someone help me translating this VB code?

Private Sub Form1_Load(ByVal sender As System.Object, _

                        ByVal e As System.EventArgs) Handles MyBase.Load

    ' Create the list to use as the custom source.    

Dim MySource As New AutoCompleteStringCollection()    

MySource.AddRange(New String() _                        

{ _                            

"January", _                            

"February", _                            

"March", _                            

"April", _                            

"May", _                            

"June", _                            

"July", _                            

"August", _                            

 "September", _                      

   })

    ' Create and initialize the text box.    

Dim MyTextBox As New TextBox()    

With MyTextBox        

.AutoCompleteCustomSource = MySource        

 .AutoCompleteMode = AutoCompleteMode.SuggestAppend        

.AutoCompleteSource = AutoCompleteSource.CustomSource        

.Visible = True    

End With

   ' Add the text box to the form.    

Me.Controls.Add(MyTextBox) 

End Sub

2 replies

Stephen Hjerpe
  • Participating Frequently
  • 1100 replies
  • November 27, 2012

Hello,

Can someone help me translating this VB code?

Private Sub Form1_Load(ByVal sender As System.Object, _

                        ByVal e As System.EventArgs) Handles MyBase.Load

    ' Create the list to use as the custom source.    

Dim MySource As New AutoCompleteStringCollection()    

MySource.AddRange(New String() _                        

{ _                            

"January", _                            

"February", _                            

"March", _                            

"April", _                            

"May", _                            

"June", _                            

"July", _                            

"August", _                            

 "September", _                      

   })

    ' Create and initialize the text box.    

Dim MyTextBox As New TextBox()    

With MyTextBox        

.AutoCompleteCustomSource = MySource        

 .AutoCompleteMode = AutoCompleteMode.SuggestAppend        

.AutoCompleteSource = AutoCompleteSource.CustomSource        

.Visible = True    

End With

   ' Add the text box to the form.    

Me.Controls.Add(MyTextBox) 

End Sub

Form1 is a window (Standard, Floating or independent) and Text box is an entry-field, although for the list of months a drop down list-box seems a better fit.


Stephen Hjerpe
  • Participating Frequently
  • 1100 replies
  • November 27, 2012

Hello,

Can someone help me translating this VB code?

Private Sub Form1_Load(ByVal sender As System.Object, _

                        ByVal e As System.EventArgs) Handles MyBase.Load

    ' Create the list to use as the custom source.    

Dim MySource As New AutoCompleteStringCollection()    

MySource.AddRange(New String() _                        

{ _                            

"January", _                            

"February", _                            

"March", _                            

"April", _                            

"May", _                            

"June", _                            

"July", _                            

"August", _                            

 "September", _                      

   })

    ' Create and initialize the text box.    

Dim MyTextBox As New TextBox()    

With MyTextBox        

.AutoCompleteCustomSource = MySource        

 .AutoCompleteMode = AutoCompleteMode.SuggestAppend        

.AutoCompleteSource = AutoCompleteSource.CustomSource        

.Visible = True    

End With

   ' Add the text box to the form.    

Me.Controls.Add(MyTextBox) 

End Sub

     *{Bench}prg-comment

     * Program1.cbl

     * Program1.cbl is generated from C:\\Project1\\Program1.Psf

     *{Bench}end

      IDENTIFICATION              DIVISION.

     *{Bench}prgid

      PROGRAM-ID. Program1.

      AUTHOR. SHjerpe.

      DATE-WRITTEN. Tuesday, November 27, 2012 7:24:15 AM.

      REMARKS.

     *{Bench}end

      ENVIRONMENT                 DIVISION.

      CONFIGURATION               SECTION.

      SPECIAL-NAMES.

     *{Bench}activex-def

     *{Bench}end

     *{Bench}decimal-point

     *{Bench}end

      INPUT-OUTPUT                SECTION.

      FILE-CONTROL.

     *{Bench}file-control

     *{Bench}end

      DATA                        DIVISION.

      FILE                        SECTION.

     *{Bench}file

     *{Bench}end

      WORKING-STORAGE             SECTION.

     *{Bench}acu-def

      COPY "acugui.def".

      COPY "acucobol.def".

      COPY "crtvars.def".

      COPY "showmsg.def".

     *{Bench}end

     *{Bench}copy-working

      77 Quit-Mode-Flag PIC S9(5) COMP-4 VALUE 0.

      77 Key-Status IS SPECIAL-NAMES CRT STATUS PIC 9(4) VALUE 0.

          88 Exit-Pushed VALUE 27.

          88 Message-Received VALUE 95.

          88 Event-Occurred VALUE 96.

          88 Screen-No-Input-Field VALUE 97.

          88 Screen-Time-Out VALUE 99.

     * property-defined variable

     * user-defined variable

      77 Form1-Handle

                 USAGE IS HANDLE OF WINDOW.

      01 .

          03 Form1-Cm-1-Container-Item.

              05      PIC  X(15)

                         VALUE IS "January".

              05      PIC  X(15)

                         VALUE IS "February".

              05      PIC  X(15)

                         VALUE IS "March".

              05      PIC  X(15)

                         VALUE IS "April".

              05      PIC  X(15)

                         VALUE IS "May".

              05      PIC  X(15)

                         VALUE IS "June".

          78 Form1-Cm-1-Container-Num VALUE IS 6.

          03 Form1-Cm-1-Container REDEFINES Form1-Cm-1-Container-Item  

          PIC  X(15)

                     OCCURS 6 TIMES

                     INDEXED  Form1-Cm-1-Container-Idx.

      77 Form1-Cm-1-Value PIC  X(15).

     *{Bench}end

      LINKAGE                     SECTION.

     *{Bench}linkage

     *{Bench}end

      SCREEN                      SECTION.

     *{Bench}copy-screen

      01 Form1.

          03 Form1-Cm-1, Combo-Box,

             COL 5.00, LINE 3.00, LINES 16.00 CELLS, SIZE 22.00 CELLS,

             3-D, ID IS 1, MASS-UPDATE 0, DROP-DOWN, UNSORTED,

             VALUE Form1-Cm-1-Value.

     *{Bench}end

     *{Bench}linkpara

      PROCEDURE DIVISION.

     *{Bench}end

     *{Bench}declarative

     *{Bench}end

      Acu-Main-Logic.

     *{Bench}entry-befprg

     *    Before-Program

     *{Bench}end

          PERFORM Acu-Initial-Routine

     * run main screen

     *{Bench}run-mainscr

          PERFORM Acu-Form1-Routine

     *{Bench}end

          PERFORM Acu-Exit-Rtn

          .

     *{Bench}copy-procedure

      COPY "showmsg.cpy".

      Acu-Initial-Routine.

     *    Before-Init

     * get system information

          ACCEPT System-Information FROM System-Info

     * get terminal information

          ACCEPT Terminal-Abilities FROM Terminal-Info

     *    After-Init

          .

      Acu-Exit-Rtn.

     *    After-Program

          EXIT PROGRAM

          STOP RUN

          .

      Acu-Form1-Routine.

     *    Before-Routine

          PERFORM Acu-Form1-Scrn

          PERFORM Acu-Form1-Proc

     *    After-Routine

          .

      Acu-Form1-Scrn.

          PERFORM Acu-Form1-Create-Win

          PERFORM Acu-Form1-Init-Data

          .

      Acu-Form1-Create-Win.

     *    Before-Create

     * display screen

             DISPLAY Standard GRAPHICAL WINDOW

                LINES 20.00, SIZE 36.00, CELL HEIGHT 10,

                CELL WIDTH 10, AUTO-MINIMIZE, COLOR IS 65793,

                LABEL-OFFSET 0, LINK TO THREAD, MODELESS, NO SCROLL,

                WITH SYSTEM MENU,

                TITLE "Screen", TITLE-BAR, NO WRAP,

                EVENT PROCEDURE Form1-Event-Proc,

                HANDLE IS Form1-Handle

     * toolbar

          DISPLAY Form1 UPON Form1-Handle

     *    After-Create

          .

      Acu-Form1-Init-Data.

     *    Before-Initdata

          PERFORM Acu-Form1-Cm-1-Content

     *    After-Initdata

          .

     * Form1

      Acu-Form1-Proc.

          PERFORM UNTIL Exit-Pushed

             ACCEPT Form1  

                ON EXCEPTION PERFORM Acu-Form1-Evaluate-Func

             END-ACCEPT

          END-PERFORM

          DESTROY Form1-Handle

          INITIALIZE Key-Status

          .

     * Form1-Cm-1

      Acu-Form1-Cm-1-Content.

          MODIFY Form1-Cm-1, MASS-UPDATE = 1, RESET-LIST = 1

          MODIFY Form1-Cm-1, ITEM-TO-ADD = TABLE Form1-Cm-1-Container

          MODIFY Form1-Cm-1, MASS-UPDATE = 0

          MODIFY Form1-Cm-1, VALUE Form1-Cm-1-Value

          .

     * Form1

      Acu-Form1-Evaluate-Func.

          EVALUATE TRUE

             WHEN Exit-Pushed

                PERFORM Acu-Form1-Exit

             WHEN Event-Occurred

                IF Event-Type = Cmd-Close

                   PERFORM Acu-Form1-Exit

                END-IF

          END-EVALUATE

          MOVE 1 TO Accept-Control

          .

      Acu-Form1-Exit.

          SET Exit-Pushed TO TRUE

          .

      Acu-Form1-Event-Extra.

          EVALUATE Event-Type

          WHEN Msg-Close

             PERFORM Acu-Form1-Msg-Close

          END-EVALUATE

          .

      Acu-Form1-Msg-Close.

          ACCEPT Quit-Mode-Flag FROM ENVIRONMENT "QUIT_MODE"

          IF Quit-Mode-Flag = ZERO

             PERFORM Acu-Form1-Exit

             PERFORM Acu-Exit-Rtn

          END-IF

          .

      Form1-Event-Proc.

     *

          PERFORM Acu-Form1-Event-Extra

          .

     ***   start event editor code   ***

     *{Bench}end

      REPORT-COMPOSER SECTION.