RichTextBox - the correct choice and how to loop

VB.NET

    Next

  • 1. Can You Hide A Tab Page
    I have a Tab Control with tab pages. The tab pages are named. As an example, one of my tab pages is named tabSubClient I can code the line tabSubClient.Visible = False The line compiles and executes but has no effect. The tab page is still visible. I can also do tabSubClient.Enabled = False which works, but I really want to hide it when the case dictates. Although both Visible & Enabled appear in intellisense, neither is shown in the documentation. Any help will be appreciated.
  • 2. Did the RichTextBox change in VS2005
    Did the RichTextBox control change in VS2005?
  • 3. TextBox value doesn't get updated in a DataGrid control
    Hi! I have a form (System.Web.UI.Page) that contains a DataGrid control and a DataTable that contains values for the data grid and that is data bound to the DataGrid. When I switch the grid to edit mode (e.g. if I set DataGrid.EditItemIndex = 0) the values in the data table are displayed correctly in TextBox controls in the DataGrid at the first time. Then, if I cause a postback (e.g. by pressing a button) and I set a new value into a certain data table data field (e.g. in the Page_Load method) the TextBox contains the old value although the data table field where the text box in data bound contains a new value. Why doesn't the TextBox control get updated to a new value? I have tested that other controls such as Labels, show the current value of the data table field but I don't understand why TextBox doesn't get the current value of the data table field. Thank you. BR, Tuomo
  • 4. Multi thread stops when opening a new form
    Below is the code with the problem (it is just one form): When you run the code, you hear a beep every second, the beep is on a new thread. When you push the button 100 forms are opend, the beep should continue, but is doesn't. Sometimes it already stops when you open 1 form, but to make sure the sample works it will open 100 forms. Who can help me? Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.ClientSize = New System.Drawing.Size(292, 266) Dim Button1 As New System.Windows.Forms.Button Button1.Text = "Open forms" AddHandler Button1.Click, AddressOf Button1_Click Me.Controls.Add(Button1) RunTimer() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim i As Integer For i = 1 To 100 Dim NewForm As New Form NewForm.Size = New System.Drawing.Size(152, 62) NewForm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen NewForm.Text = i NewForm.Show() Next End Sub Sub RunTimer() Dim TimerDelegate As New Threading.TimerCallback(AddressOf TimerTask) Dim TimerItem As New System.Threading.Timer(TimerDelegate, Nothing, 0, 1000) End Sub Sub TimerTask(ByVal StateObj As Object) Beep() End Sub
  • 5. About MyForm.Designer.vb
    I've created my Windows Forms application using VB 2003. I've just started to use VB 2005, and opened that same project with VB 2005. VB 2005 seems to generate "Myform.Designer.vb"-file for all new forms, which is good feature in my mind. Is it possible to generate .Designer.vb-file simple way for those all older forms somehow which were created earlier using VB 2003? I succeeded to make one using "copy/paste"-technique, but it may not be the best way :) Mika

RichTextBox - the correct choice and how to loop

Postby JCCDevel » Sun, 16 Dec 2007 03:20:33 GMT

Hello,

I'm working on a pretty simple web app in which the user will be
pasting in a list of values (letters and number  - like "1V456") most
likely from an Excel worksheet.  I then want the application to check
this list against tables in a sql server database for different things
(like - does it exist in database, etc.)  My co-worker thinks that a
richtextbox is the best control to use for this.  I'm new to VB.Net so
I'm not real familiar with this control.  Is it the right way to go?
I've been doing a little research on the web and don't see it used too
much for this situation.  I have been playing with it a bit and have
gotten results to point to a table, but it is adding in strange
characters and blank entires.  Here is the code:

<code>


        For Each str As String In RichTextBox1.Lines
            InsertSQL = "Insert into Test_test values ('" & str & "
')"
            dr1 = SqlHelper.ExecuteReader(CONNSTRING,
CommandType.Text, InsertSQL)
        Next

</code>

Is a "For each" statement the way to go?

Thanks in advance for your time!

JCC

Re: RichTextBox - the correct choice and how to loop

Postby Lloyd Sheen » Mon, 17 Dec 2007 02:27:01 GMT









You should be using parameters to execute your SQL statement.

InsertSQL = "Insert into Test_test values (@InsertValue)"

Then you are executing using a datareader.  Since you are not reading 
anything use ExecuteNonQuery

LS 


Similar Threads:

1.I don't believe this code gives the correct RichTextBox string size

I don't believe the code below gives the correct string size in inches.

Can any one tell me what is wrong?

I need to know the size of the string before I add it to the RichTextBox





Thanks





Public ReadOnly Property TxtMeasureString(ByVal str As String) As SizeF

Get

Dim Gr As Graphics = Me.CreateGraphics

Dim MeasureString As SizeF = Gr.MeasureString(str, 
ControlRichTextBox1.SelectionFont())

TxtMeasureString = New SizeF(MeasureString.Width / Gr.DpiX, 
MeasureString.Height / Gr.DpiY)

Gr.Dispose()

End Get

End Property


2.Need correct VBScript syntax for looping through form controls

Hello,

Can someone give me an example of looping through a set of checkboxes or 
radio buttons on an html form, for the purpose of determining which one(s) 
are selected? I usually use JS for this, but would like to use VBS and can't 
make it work. Thanks.


3.Choices, choices - does Style exist?

Am Sat, 21 Oct 2006 03:28:06 UTC,  schrieb "Greg Maxey" 
< XXXX@XXXXX.COM >  auf microsoft.public.word.vba.general :

> Sub Test2() 

  I would implement this as a function: 

  Function StyleExists (styName As String) As Boolean
     Dim testName As String

> On Error GoTo Handler
   testName =  ActiveDocument.Styles(styName).NameLocal
   StyleExists = True
   Exit function
> Handler:
>   If Err.Number = 5941 Then
       StyleExists = False
>      Err.Clear
>   End If
  End Function
  
   
   Same applies to the existence of DocVariables and such stuff. 

   I just try to generalise it to any kind of collection, passing the 
collection as a parameter of type Object to the function, but run into
problems. I get an error number 91.

   Where do I find all those error numbers? 

Yours, 
L.W.

4.Choices, choices

5.Quiz in VB - Multiple choice and single choice questions

Can anyone please give me some clues on how to track the right answers
in multiple-choice type questions (using checkbox) and single-choice
questions (rdio buttons) and also how to store the right answer value
in the db?

Much appreciated

6. at runtime, get possible choices for xs:choice class

7. Does Setting RichTextBox.SeletcionStart Change RichTextBox.Text ?!?!?

8. Corrected: How do I add a "Select an item..."-choice in a databound DropDownList?



Return to VB.NET

 

Who is online

Users browsing this forum: No registered users and 93 guest