RichEdit TextBox - Why won`t this work?

In this category you can exchange your programming questions and solutions.
Post Reply
Darren
Posts: 63
Joined: Wed May 11, 2011 11:55 am

RichEdit TextBox - Why won`t this work?

Post: # 866Post Darren
Mon Apr 23, 2012 10:16 am

Can anybody please tell me why this program will not execute as required?

OBJECT MainForm AS Form
  Left=239
  Top=114
  Caption="New Form"
  ClientHeight=383
  ClientWidth=384
  OBJECT RichEdit1 AS RichEdit
    Left=0
    Top=0
    Width=377
    Height=313
    Line(0)="RichEdit1"
    TabOrder=0
  END OBJECT `{RichEdit1}
OBJECT Button1 AS Button
    Left=264
    Top=136
    Width=75
    Height=25
    Caption="OK"
    TabOrder=0
    OnClick=Button1_Click
  END OBJECT `{Button1}
END OBJECT `{MainForm}

Dim Counter As Integer

MainForm.StayOnTop = 1

Mainform.Showmodal

Sub Button1_Click
    RichEdit1.Text = "Process Start"

    For Counter= 1 To 5000
        MainForm.Caption = Str$(Counter)
    Next Counter

    Richedit1.AddText = "Process Finished"
End Sub

All I want to do is:-

On pressing the button I want the text box to desplay "Process Start"

Then start the counter (this is to simply delay the next process)

Once the counter has reached 5000, then also display the line "Process Finished"

It seems that, when I press the button the "Process Start" line only gets put onto the RichEdit text box after the counter has completed its task.

Can anybody help???


Aurelz
Posts: 15
Joined: Tue Apr 24, 2012 7:44 am

RichEdit TextBox - Why won`t this work?

Post: # 867Post Aurelz
Tue Apr 24, 2012 7:47 am

This code works for me,but bad is because you put button on
richedit control:
OBJECT MainForm AS Form
  Left=239
  Top=114
  Caption="New Form"
  ClientHeight=383
  ClientWidth=384
  OBJECT RichEdit1 AS RichEdit
    Left=0
    Top=0
    Width=377
    Height=313
    Line(0)="RichEdit1"
    TabOrder=0
  END OBJECT `{RichEdit1}
OBJECT Button1 AS Button
    Left=264
    Top=136
    Width=75
    Height=25
    Caption="OK"
    TabOrder=0
    OnClick=Button1_Click
  END OBJECT `{Button1}
END OBJECT `{MainForm}

Dim Counter As Integer

`MainForm.StayOnTop = 1

Mainform.Showmodal

Sub Button1_Click()
    RichEdit1.Text = "Process Start"

    For Counter= 1 To 5000
        MainForm.Caption = Str$(Counter)
    Next Counter

  `  Richedit1.AddText = "Process Finished"
End Sub

Post Reply