הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Monday, May 26, 2014 2:55 PM
How do you insert a table to a richtextbox with a click of a button?
Also I'm aware on a chart component in the Toolbox - how do you embed that chart (that the user will be able to customize) where the caret is positioned?
Thanks!
JDS404 Check out my blog at www.interlinkjds.wordpress.com!
All replies (9)
Wednesday, May 28, 2014 3:50 AM ✅Answered
With a bunch of looping code depending from the type of the table.
However, for a beginning programmer who knows the type of the table, this should be really very easy.
Success
CorIt could only be a basic table.
For example, when you insert a table into Microsoft Word, that default design - the same with the bar chart.
Thanks again.
JDS404 Check out my blog at www.interlinkjds.wordpress.com!
Hi,
I agree with Cor that if we are familiar with RTF format, then it is quite easy, but if we are not so familiar with that format, then we could use the following simple way.
First, insert the table with Word, copy that table, then paste that table to your richtextbox, then use the following code to get the rtf string.
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Text = RichTextBox1.Rtf.ToString()
End Sub
Then we will get the rtf string.
The following code shows the way to insert a table with 6 rows and 3 columns with different width.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sbTaRtf As New System.Text.StringBuilder
sbTaRtf.Append("{\rtf1")
For index As Integer = 0 To 5
sbTaRtf.Append("\trowd")
sbTaRtf.Append("\cellx1000") 'set that cell width to 1000
sbTaRtf.Append("\cellx2000")
sbTaRtf.Append("\cellx3000")
sbTaRtf.Append("\intbl \cell \row")
Next
sbTaRtf.Append("\pard")
sbTaRtf.Append("}")
RichTextBox1.Rtf = sbTaRtf.ToString()
End Sub
Result:
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
Wednesday, May 28, 2014 7:12 AM ✅Answered
How do you insert a table to a richtextbox with a click of a button?
Also I'm aware on a chart component in the Toolbox - how do you embed that chart (that the user will be able to customize) where the caret is positioned?
Thanks!
JDS404 Check out my blog at www.interlinkjds.wordpress.com!
Adding a chart control to a RichTextBox at the cursor location does not make the chart control part of the RichTextBoxs Rtf. So if you were thinking you could save the RichTextBoxs Rtf and reload it showing the Chart Control then that would not work. As the RichTextBoxs Rtf will not contain anything about the Chart Control.
Also how would you expect a user to be able to customize an already created Chart Control? Do you know anything about the Chart Control? Or how to customize a Chart Control after it is created? Have you read about the Windows Forms Chart Control?
Adding a Control to a RichTextBox just places it in front of the RichTextBoxs client area I believe. The control is not part of the text somehow. Although it can be placed at a location in front of the text at the carets current location if the carret is not outside of the currently displayed text.
Perhaps you may want to display an image of a Chart Control in the RichTextBoxs text at the current caret position so that the image becomes part of the RichTextBoxs Rtf. That image can then be saved as part of the RichTextBoxs Rtf so that reloading the RichTextBox with the saved file would reload that image.
But before asking questions about things perhaps it would be wise to learn something about the things the questions are about. Rather than thinking things can do things just because an idea to use things a certain way came up.
As for now I don't believe you understand the Chart Control well enough or placing controls in a RichTextBox well enough to know what questions to ask.
La vida loca
Tuesday, May 27, 2014 6:37 AM
Hi,
I moved this thread to Visual Basic forum for better support because your issue is about VS.net development.
Thanks,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.
Tuesday, May 27, 2014 2:55 PM
With a bunch of looping code depending from the type of the table.
However, for a beginning programmer who knows the type of the table, this should be really very easy.
Success
Cor
Tuesday, May 27, 2014 6:23 PM
With a bunch of looping code depending from the type of the table.
However, for a beginning programmer who knows the type of the table, this should be really very easy.
Success
Cor
It could only be a basic table.
For example, when you insert a table into Microsoft Word, that default design - the same with the bar chart.
Thanks again.
JDS404 Check out my blog at www.interlinkjds.wordpress.com!
Wednesday, July 18, 2018 2:57 PM
when i click the insert table my table name not showing its showing only the table . i want some text above the table and below blank table how can i do this. please help me for example below.
Here is table Name:-
Wednesday, July 18, 2018 3:02 PM
Hi
Well, the first thing you can do is to start a new thread as this one already has an answer.
The second thing would be to show your code.
Regards Les, Livingston, Scotland
Wednesday, July 18, 2018 4:56 PM
can you please send me the code
Wednesday, July 18, 2018 6:35 PM | 1 vote
Hi
Send me your code.
Regards Les, Livingston, Scotland