تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
التعامل مع ال Clipboard بال C# و VB.net
#1
كاتب الموضوع : AhmedEssawy

لوضع بيانات في ال Clipboard


' Visual Basic

كود :
[FONT=Arial][color=black]Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click[/color][/FONT][FONT=Arial][COLOR=black]
[color=black][FONT=Arial]Clipboard.SetDataObject(TextBox1.Text[/FONT][/color][color=black][FONT=Arial])[/FONT][/color]
[color=black][FONT=Arial]End Sub[/FONT][/color]
[/COLOR][/FONT]
// C#

كود :
[FONT=Arial][color=black][COLOR=black][FONT=Arial]private void button1_Click(object sender, System.EventArgs e[/FONT][/color][color=black][FONT=Arial])[/FONT][/color][/COLOR][/FONT][FONT=Arial][COLOR=black]
[color=black][FONT=Arial]{[/FONT][/color]
[color=black][FONT=Arial]Clipboard.SetDataObject(textBox1.Text[/FONT][/color][color=black][FONT=Arial]);[/FONT][/color]
[color=black][FONT=Arial]}[/FONT][/color]

[/COLOR][/FONT]


لاسترجاع بيانات من ال Clipboard



' Visual Basic

كود :
[FONT=Arial][color=black]Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click[/color][/FONT][FONT=Arial][COLOR=black]
[color=black][FONT=Arial]' [/FONT][/color][color=black][FONT=Arial]Create a new instance of the DataObject interface[/FONT][/color][color=black][FONT=Arial].[/FONT][/color]
[color=black][FONT=Arial]Dim data As IDataObject = Clipboard.GetDataObject[/FONT][/color][color=black][FONT=Arial]()[/FONT][/color]
[color=black][FONT=Arial]' [/FONT][/color][color=black][FONT=Arial]If the data is text, then set the text of the[/FONT][/color]
[color=black][FONT=Arial]' [/FONT][/color][color=black][FONT=Arial]TextBox to the text in the Clipboard[/FONT][/color][color=black][FONT=Arial].[/FONT][/color]
[color=black][FONT=Arial]If (data.GetDataPresent(DataFormats.Text)) Then[/FONT][/color]
[color=black][FONT=Arial]TextBox1.Text = data.GetData(DataFormats.Text).ToString[/FONT][/color][color=black][FONT=Arial]()[/FONT][/color]
[color=black][FONT=Arial]End If[/FONT][/color]
[color=black][FONT=Arial]End Sub[/FONT][/color]
[/COLOR][/FONT]
// C#

كود :
[FONT=Arial][color=black][COLOR=black][FONT=Arial]private void button1_Click(object sender, System.EventArgs e[/FONT][/color][color=black][FONT=Arial])[/FONT][/color][/COLOR][/FONT][FONT=Arial][COLOR=black]
[color=black][FONT=Arial]{[/FONT][/color]
[color=black][FONT=Arial]// [/FONT][/color][color=black][FONT=Arial]Create a new instance of the DataObject interface[/FONT][/color][color=black][FONT=Arial].[/FONT][/color]
[color=black][FONT=Arial]IDataObject data = Clipboard.GetDataObject[/FONT][/color][color=black][FONT=Arial]();[/FONT][/color]
[color=black][FONT=Arial]// [/FONT][/color][color=black][FONT=Arial]If the data is text, then set the text of the[/FONT][/color]
[color=black][FONT=Arial]// [/FONT][/color][color=black][FONT=Arial]TextBox to the text in the Clipboard[/FONT][/color][color=black][FONT=Arial].[/FONT][/color]
[color=black][FONT=Arial]if (data.GetDataPresent(DataFormats.Text[/FONT][/color][color=black][FONT=Arial]))[/FONT][/color]
[color=black][FONT=Arial]textBox1.Text = data.GetData(DataFormats.Text).ToString[/FONT][/color][color=black][FONT=Arial]();[/FONT][/color]
[color=black][FONT=Arial]}[/FONT][/color]


[/COLOR][/FONT]
}}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  احتراف التعامل مع ( ملفات التهية ini ) باسهل الطرق مكتبه كاملة من صنعى : اصدار 1.0.0 ali.alfoly 10 9,129 07-12-22, 02:48 PM
آخر رد: volkovch
  احتراف التعامل مع ( ملفات التهية ini ) باسهل الطرق مكتبه كاملة من صنعى : اصدار 1.0.1 ali.alfoly 2 4,150 19-01-19, 08:51 AM
آخر رد: ahmedtonsy
  التعامل مع الملفات RaggiTech 0 2,569 17-10-12, 09:16 PM
آخر رد: RaggiTech
  التعامل مع المجلدات RaggiTech 0 2,426 17-10-12, 09:11 PM
آخر رد: RaggiTech
  (لعبة الذاكرة Memory Game) لتفهم التعامل مع مصفوفة الادوات RaggiTech 0 2,716 17-10-12, 09:05 PM
آخر رد: RaggiTech
  مثال رائع من مايكروسوفت يوضح اكواد التعامل مع الملفات و بتصميم ممتاز(80ك ب) RaggiTech 0 2,389 17-10-12, 07:19 PM
آخر رد: RaggiTech
  التعامل مع البرامج والتطبيقات الخارجية RaggiTech 0 2,334 17-10-12, 06:54 PM
آخر رد: RaggiTech
  لانشاء قاعده بيانات و التعامل معها من خلال الكود RaggiTech 0 2,690 17-10-12, 05:24 PM
آخر رد: RaggiTech
  كيفيه التعامل من ال ImageList Class RaggiTech 0 2,350 17-10-12, 05:19 PM
آخر رد: RaggiTech
  كيفيه التعامل مع NumericUpDown control RaggiTech 0 2,181 17-10-12, 05:19 PM
آخر رد: RaggiTech

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم