473,395 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Problem with RichTextBox DragDrop

Hello Everybody,

I have a rich text box in which i have to drop a custom
object (user defined object). When i drop a string into
the richtextbox control, everything goes fine but if i
drop a custom object, the value of the object becomes null.

I am very much confused.

Kindly help me out in this regard.

Following is a sample of the code:

if (e.Data.GetDataPresent(typeof(string)))
{
string s = (string) e.Data.GetData(typeof(string));
rtb.SelectedText = s;
}
else if (e.Data.GetDataPresent(typeof(Class1)))
{
Console.WriteLine(sender.ToString());
Class1 c1 = (Class1)e.Data.GetData(typeof(Class1));
if (c1 == null)
{
MessageBox.Show("null");
}
else
{
rtb.SelectedText = c1.Name + " 123";
}
//rtb.SelectedText = Class1.ss + " 123";
}

NOTE: Class1 is a user-defined class which has a
property 'Name'.
I cannot drop 'Name' directly as string because i use the
object in another control.

Here if i drop the object Class1, always MessageBox "null"
is displayed.

Am i doing any mistake here? is there any work-around for
this?

Regards.

Sethuraman V
Nov 15 '05 #1
0 2216

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: L.Peter | last post by:
Dear Group, I am doing Drag and Drop function and see this problem if I select 3 from listBox1 and drag to listBox2, the value in listBox1 is not updated, even I move (or use up and down keyboard)...
0
by: SamSpade | last post by:
How to program DragDrop with a RichTextBox? If I develop by inherit I can override the DragDrop methods and do it that way. But if I want to include a RichTextBox on a UserControl the...
3
by: Gary Dunne | last post by:
I'm writing an app that requires drag and drop operation between a ListView and a TreeView control. (The source is the ListView). During the drag drop operation I want to be able to detect the...
0
by: Robert Liles | last post by:
I am trying to implement DragNDrop onto a RichTextBox. I have enabled AllowDrop, but I still don't get access to the DragEnter, DragDrop, etc. What am I missing? Thank you, Bobbo
4
by: SStory | last post by:
I want to drag a message from Outlook to a richtextbox on a vb.net form. I don't get the message body. I have searched all over the place and found nothing. Does anyone know how to do this? I...
0
by: positivebalance | last post by:
..net 2.0 richtextbox autodragdrop how to make the control respond to Ctrl key for move copy? it's handy to have the enableautodragdrop is true but two odd things I notice: 1. when I first...
1
by: dshubhangi | last post by:
hi I've set richtextbox OLEDropMode Manual,catched OLEDragDrop event & in that event written below code Richtextbox1.OLEObjects.add ,,data.files(1) Now I'm able to catch OLEDragDrop as well as...
0
by: Itanium | last post by:
Hi all! I'm getting in some trouble with Drag and Drop operations. I have a RichTextBox inside a Form. I want to allow text moving inside the RichTextBox itself, which is achieved by simply...
4
by: Siv | last post by:
Hi, I have this block of old code: Private Sub txtBoxes_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) _ Handles txtQL12.DragDrop, txtQL11.DragDrop,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.