Programatically getting a RichTextBox to scroll - What Am I doing Wrong

VB.NET

    Next

  • 1. Input/output to parallel port?
    I want to input from and output to the parallel port to read switches or turn stuff on/off. I program Microchip PIC processors in PicBasic but am just wondering if it's just as easy to replace a pic processor with a PC using VB.net.
  • 2. appPath
    Dim appPathFn As String appPathFn = System.Windows.Forms.Application.ExecutablePath Windows is not a member of System I saw come code in the internet as appPathFn = Application.ExecutablePath but that does not work for me I am using visual basic .net express 2005. don't know if that make any difference. So far Google has not helped me yet
  • 3. Overrides and mybase ??
    Hello, I have seen the following routines in a class and don't understand how they work. For one, why two new() routines? Which is executed? Why not just use one routine? What does the mybase do in this case? Bit confusing! :) Thanks '<remarks/> Public Sub New() MyBase.New() Me.Url = System.Configuration.ConfigurationSettings.AppSettings("ReportServerURL") + "/ReportService.asmx" End Sub '<remarks/> Public Sub New(ByVal ReportServerURL As String) MyBase.New() Me.Url = ReportServerURL + "/ReportService.asmx" End Sub
  • 4. How to make a program which would move the mouse cursor,click and so on...
    Hi, I have .Net VB and have worked with it, so I now some stuff in general. It woud be great if someone could help me, or give me some advice. I'm visiting a web page, so all the buttons and so on are always on the same coordinants. So I would just have to make a program which when I run, would open Internet Explorer, go to that web page and then first log on, and then clik everything i need. The problem is that the links are very long, they have a SESSION part and so on, and I think it would be easier to just move the mouse and click and navigate through the web page. An also I would need to pause for a period of time 5,10,20 seconds, untithe page loads. So basicly i would do everything with SCREEN COORDINATES. Eg. goto (100,200) click [open ie or firefox] goto (100,30) click [click the link in favorites] goto (300,400) type in username,pass [type] goto (100,300) click [click on a link] goto (100,400) click [click] pause 10 seconds [pause] goto (1020,700) click on the scrollbar down arrow [click] So if anyone can just get me started it would be great! Thanks. Marko

Programatically getting a RichTextBox to scroll - What Am I doing Wrong

Postby One Handed Man » Thu, 04 Sep 2003 23:07:25 GMT

Ive been working on this since yesterday and its bugging me. Although the
event is firing, The box does not scroll. Can anyone see what Im doing
wrong. I suspect it is stupidly simple.



TIA



SubClass RichtextBox in order to fire the OnVScroll Event

Public Class MyRichTextBox

Inherits RichTextBox

Public Sub PerformVScroll()

MyBase.OnVScroll(EventArgs.Empty)

End Sub

End Class

- This button invokes the PerformVScroll -

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PerformVscroll.Click

RTB.PerformVScroll()

End Sub

- THis confirms that the event has been raised -

Private Sub handleScroll(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RTB.VScroll

Console.WriteLine("Handling scroll")

End Sub




-- 
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.




Re: Programatically getting a RichTextBox to scroll - What Am I doing Wrong

Postby Patrick Steele [MVP] » Fri, 05 Sep 2003 01:36:16 GMT

In article < XXXX@XXXXX.COM >, terry_burnsREMOVE%
FOR%NO% XXXX@XXXXX.COM  says...

You're simply causing all event subscribers to be notified that a scroll 
has happened.  It's not actually performing the scroll.  For that, you 
would probably either need to:

1) Send the WM_VSCROLL message to your control.
2) or try the ScrollToCaret() function.

-- 
Patrick Steele
Microsoft .NET MVP
 http://www.**--****.com/ 

Re: Programatically getting a RichTextBox to scroll - What Am I doing Wrong

Postby One Handed Man » Fri, 05 Sep 2003 03:13:30 GMT

The carret worked ok so thanks for that. I looked for examples on how to
send messages to the control but of yet have not found any. Do you have a
good reference I can look at ?

Many Thanks

-- 
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.






the



Re: Programatically getting a RichTextBox to scroll - What Am I doing Wrong

Postby Patrick Steele [MVP] » Fri, 05 Sep 2003 03:42:18 GMT

In article < XXXX@XXXXX.COM >, terry_burnsREMOVE%
FOR%NO% XXXX@XXXXX.COM  says...

See this google post:

 http://www.**--****.com/ 

-- 
Patrick Steele
Microsoft .NET MVP
 http://www.**--****.com/ 

Re: Programatically getting a RichTextBox to scroll - What Am I doing Wrong

Postby One Handed Man » Fri, 05 Sep 2003 16:46:39 GMT

Excellent Patrick, You have been most helpful this did the trick

;-D

-- 
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.






a



Similar Threads:

1.What am I doing wrong??

Here is what I am trying:

My.Computer.FileSystem.CopyFile("\\server\all\sets\!!!!!PREFS
\Application Data", _
"C:\Documents and Settings\" & Environment.UserName & "\Application
Data\Adobe", True)
        MessageBox.Show("Done Resetting Application Data, Press OK to
Continue and reset Local Settings data", "Backup in progress...",
MessageBoxButtons.OKCancel, MessageBoxIcon.Information)
        My.Computer.FileSystem.CopyFile("\\server\all\sets\!!!!!PREFS
\Local Settings", _
"C:\Documents and Settings\" & Environment.UserName & "\Local Settings
\Application Data\Adobe", True)
        MessageBox.Show("Done Resetting Local Settings data, Press OK
to Continue.", "Backup in progress...", MessageBoxButtons.OK,
MessageBoxIcon.Information)

I get the error that: \\server\all\sets\Application Data  is not
found, but it is there, and inside that folder I want to copy a folder
to c:\doc and set\user\application data\adobe

Also, will this work like this, one statement after another to do two
things?

thanks

2.What am I doing wrong - Trying to update

I have enclosed the sample code that I created.  I want to read in employee 
data, and modify a few fields.  I have tried to globally declare the objects 
that I need but I still am having problems.  I want to update in a seperate 
subroutine and seem to have problems.  HELP please.

-------------------------------------------
Public Class Form1

    Inherits System.Windows.Forms.Form
    Public cn As OleDb.OleDbConnection
    Public ds As DataSet
    Public da As OleDb.OleDbDataAdapter
    Public rowEmployee As DataRow

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles MyBase.Load

        Try
            Dim strConn As String
            strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data 
Source=C:\adonetsbs\SampleDBs\nwind.mdb;"

            Dim cn As New OleDb.OleDbConnection(strConn)

            Dim strSQL As String
            strSQL = "SELECT EmployeeID, FirstName, LastName, Address, City, 
Region, " & _
                "PostalCode from Employees ORDER BY LastName, FirstName"

            Dim da = New OleDb.OleDbDataAdapter(strSQL, strConn)
            Dim ds As New DataSet

            da.Fill(ds, "Employees")

            Dim tbl As DataTable = ds.Tables(0)

            'rowEmployee = New DataRow
            rowEmployee = tbl.Rows(0)
            txtFirstName.Text = rowEmployee("FirstName")
            txtLastName.Text = rowEmployee("LastName")
            txtAddress.Text = rowEmployee("Address")

        Catch ex As Exception
            MessageBox.Show(ex.Message & " :: " & ex.Source)
        Finally
        End Try
    End Sub

    Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles btnUpdate.Click
        Try
            rowEmployee("LastName") = txtLastName.Text
            da.Update(ds)

        Catch ex As Exception

            MessageBox.Show(ex.Message & " :: " & ex.Source)

        End Try

    End Sub
End Class
---------------------------------------

When it runs I get the following error:

"Object reference not set to an instance of an object."

on the             da.Update(ds)       line in the btnUpdate_Click routine.

HELP.

Thanks,

Gary


3.Project build problem - what am I doing wrong?

I have a program that needs to access a prewritten external data file
that is supplied with the program. I want to place this data file in
Environment.SpecialFolder.LocalApplicationData\MyProgramFolder\

In the program's setup project I've done: Add Special Folder | User's
Application Data File, then within this created a folder called
MyProgramFolder, then Add File and pointed to a copy of my external
data file, which duly appears in the folder contents (EXCEPT that it
has a wavy line underneath!)

But unfortunately the resulting setup program does not install the
external data file where it should - in fact as far as I can see it
does not install it at all anywhere on the target PC.

Cany anyone advise what I'm doing wrong please? The fact that the file
entry has a wavy line underneath is presumably indicative of an error
but what's the cause and how do I fix it?

JGD

4.Table doesn't update - What am I doing wrong?

I have a form that has three textboxes on.  I want to be able to modify the 
FirstName, LastName, and Address

Here is the code to load the data
----------------------------------------------------------------------------
   Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles MyBase.Load

        Dim strSQL As String = "Select * from Contact where sysid = '" & 
g_sysID & "'"
        DB = New SqlClient.SqlDataAdapter(strSQL, CN)
        ES.Clear()
        DB.Fill(ES, "Contact")

        If ES.Tables("Contact").Rows.Count > 0 Then
            txtAddress.Text = 
ES.Tables("Contact").Rows(0).Item("con1_02_03")
            txtFirst_Name.Text = 
ES.Tables("Contact").Rows(0).Item("First_Name")
            txtLast_Name.Text = 
ES.Tables("Contact").Rows(0).Item("Last_Name")
        End If

    End Sub
--------------------------------------------------------------------------
Here is the code to update the table
--------------------------------------------------------------------------
   Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles btnUpdate.Click

        Try
            es.Tables(0).Rows(0).Item("First_Name") = txtFirst_Name.Text
            es.Tables(0).Rows(0).Item("Last_Name") = txtLast_Name.Text
            es.Tables(0).Rows(0).Item("con1_02_03") = txtAddress.Text
            ES.AcceptChanges()
            DB.Update(ES, "Contact")

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub
-----------------------------------------------------------------
Why doesn't the table update?  Can anyone give me an explanation and also if 
I need to change code, please tell me where to put the modifications?

Thanks,

Gary


5.Newbe question, What am I doing wrong

Hi,
I have two questions the first is: in the example below how can I call
an event from within a statement, such as replace Stop1 with cmdStop1
which is a button on my form?
My second question again deals with the example below. Shouldn't I see
the valve of " i" counting away in the  txtCount1 text box? I don't
see anything in the text box and would like to know what I'm doing
wrong. Thanks in advance for any and all help.
Regards,
Ken



 Stop1 = 0
        Do
            For i As Integer = 1 To 10
                txtCount1.Text = i
                If Stop1 = 1 Then
                    Exit Do
                End If
            Next i
        Loop
    End Sub

6. What am I doing wrong?

7. What am i doing wrong?

8. What am I doing wrong?



Return to VB.NET

 

Who is online

Users browsing this forum: No registered users and 95 guest