473,788 Members | 2,848 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GetData Present(typeof( string)))
{
string s = (string) e.Data.GetData( typeof(string)) ;
rtb.SelectedTex t = s;
}
else if (e.Data.GetData Present(typeof( Class1)))
{
Console.WriteLi ne(sender.ToStr ing());
Class1 c1 = (Class1)e.Data. GetData(typeof( Class1));
if (c1 == null)
{
MessageBox.Show ("null");
}
else
{
rtb.SelectedTex t = c1.Name + " 123";
}
//rtb.SelectedTex t = 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 2235

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

Similar topics

0
1335
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) to select number 4, the selectedItem.ToString() still shows 3 Am i doing something wrong? Here is the file **** using System;
0
906
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 MethodName drop down box does not include methods for the DragDrop events. Is there some way to get the methods to show? Is it OK to program them manually?
3
3795
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 target node in the treeview and auto expand it if applicable... but after a fair bit of head scratching I can't find any easy way to accomplish this. I think what i really need is the equivalent of the HitTest method from the COM version of the...
0
924
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
14605
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 don't care about attachments. I just need the text. Thanks, Shane
0
1310
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 use the control it gives a no dragdrop allowed cursur effect but on second dragdrop it works ok forevermore until I change the e.drageffect.copy to e.drageffect.move or vice versa. always seems to need some initialization but this is not...
1
2837
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 Dropped text/paint files r shown in richtextbox.But with above code ,when I DragDrop text file it is opened automatically,When I dragDrop Paint file it is activated in richtextbox itself.I don't want to display/activate the file dragdropped on...
0
1780
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 enabling the EnableAutoDragDrop property... On the other hand, when dragged text comes from an external application (or another component in my app) I want to apply some extra formatting (put the dropped text in bold for example), or simply not allow...
4
1689
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, txtQL10.DragDrop, txtQL09.DragDrop, _ txtQL08.DragDrop, txtQL07.DragDrop, txtQL06.DragDrop, txtQL05.DragDrop, _ txtQL04.DragDrop, txtQL03.DragDrop, txtQL02.DragDrop,
0
10172
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.