0

So, I am trying to have a user scroll to the bottom of my rich text box and once they hit the bottom, I want the checkbox to become visible. I have searched online and tried a few solutions and they haven't worked yet. Any assistance would be helpful. Thank you

using System;
using System.Windows.Forms;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;
using Microsoft.Office.Core;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using EUSAA;
using System.Threading.Tasks;

namespace EUSAA
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();

            txtDateTime.Text = DateTime.Now.ToString();
            txtUsername.Text = 
System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            btnClose.Visible = false;
            chkAgree.Visible = false;
            rtbSecurityAwareness.LoadFile("Security Awareness.rtf");
        }

        private void chkAgree_CheckedChanged(object sender, EventArgs e)
        {
            if (chkAgree.Checked)
            {
                btnClose.Visible = true;
            }
            else btnClose.Visible = false;
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            using (StreamWriter sw = File.AppendText(@"I:\Security Awareness 
Signed Users\Signed Users.txt"))
            {

sw.WriteLine(System.Security.Principal.WindowsIdentity.GetCurrent().Name + 
"\t" + DateTime.Now.ToString());
            }
            Environment.Exit(0);
        }

    }
}
Freggar
  • 1,049
  • 1
  • 11
  • 24
Dave_M
  • 3
  • 1
  • Can't you check scrollbar position in scroll event somehow? [Here](https://social.msdn.microsoft.com/Forums/vstudio/en-US/10afb691-58a5-4d33-9dbe-ab7afefa1afd/how-do-i-detect-user-has-reached-end-of-rich-text-box?forum=vbgeneral) is a solution with polling. – Sinatr Jun 13 '18 at 13:37
  • [See here](https://stackoverflow.com/questions/14163007/catch-textbox-scroll-event) on catching the scroll event. You then can use rtb.GetXXX functions.. – TaW Jun 13 '18 at 13:38

0 Answers0