Showing posts with label Auto Scroll. Show all posts
Showing posts with label Auto Scroll. Show all posts

Friday, May 3, 2013

How to Auto scroll TextView Android Java

I listed how to auto-scroll text containers in C# while ago, and now that I am developing other applications for Android, I needed to do the same for the following:

TextView:
Rx_text is a TextView Container.  and O_Text is a variable of type String


Rx_text.append(O_Text);
Rx_text_scroll_view.scrollTo(0, Rx_text.getBottom());


Thursday, May 2, 2013

How to Auto scroll TextBox, ListBox, ListView C# C-Sharp


Programming In C# with Visual Studio


Sometimes you need to add this little trick in your code to ease using it. this trick is to force the TextBox, ListBox, ListView, or DataGridView to scroll down to the last item was entered.


Here are some info on how to do an Auto-scroll for your program controls

TextBox auto-scroll

textBox1.SelectionStart = textBox1.Text.Length;
textBox1.ScrollToCaret();

ListBox auto-scroll

listBox1.SelectedIndex = listBox1.Items.Count - 1;
listBox1.SelectedIndex = -1;

ListView auto-scroll

listView1.EnsureVisible(listView1.Items.Count - 1);TreeView autoscroll
treeView1.Nodes[treeView1.Nodes.Count - 1].EnsureVisible();

DataGridView auto-scroll

dataGridView1.FirstDisplayedCell =
dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];