الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Binding Data Problem

بدأه feras jamal في 27 مايو 2009 · 2 رد · 396 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

كيف يمكن تجنب المشكلة التالية:

عندي فورم يحتوي على 2 text box حيث اقوم بجلب بيانات من قاعدة البيانات لهذه الكنتروز

عندما افتح الفورم اول مرة لا يوجد اي مشاكل في جلب البيانات

TextBox1.DataBindings.Add("Text", dsView, "News.EnglishText")

TextBox2.DataBindings.Add("Text", dsView, "News.ArabicText")

ولكن

عند اغلاقه وفتحه مرة اخرى تظهر لي رسالة انه لا يمكن عمل binding مرتين لنفس الـ property

مع العلم ان هذا الفورم هو sub form from the main one (its not the main one)

و لتجنب حدوث هذا يجب اغلاق البرنامج بكامله وهذا طبعا غير عملي

هل يوجد احد لديه علم بالموضوع

ارجو المساعدة

If your actions inspire others to dream more, learn more, do more and become more, you are a leader

Best Regards

Feras Abualrub

#2

مرحبا أخي الكريم,

هل يمكنك عرض الـ( Code ) الذي تقوم من خلاله باستعداء النموذج الذي يعرض الخطأ ؟

وأيضا لوسمحت ( Code ) الإتصال مع الإجراء الحاوي له, وشكراً .

بالتوفيق

The important thing is not so much

that every child should be taught,

as that every child should be given the wish to learn.

#3

Viewfrm.ShowDialog()

هذا لإستدعاء الفورم من الـ main

مع العلم انه تعريف الـViewfrm موجود كـ public inside module

و هذا الكود هو لإظهار الاخبار حيث يمكن للمستخدم فيما بعد التعديل عليها

Public Sub get_connection()

conView.ConnectionString = "Data Source=FROST;Initial Catalog=Viewer;Integrated Security=True"

End Sub

Public Sub View_news()

Try

If (conView.State = ConnectionState.Closed) Then

get_connection()

conView.Open()

End If

Catch ex As Exception

MsgBox(ex.ToString())

End Try

Try

Dim cmdView As New SqlCommand("Select EnglishText,ArabicText from News", conView)

daView.SelectCommand = cmdView

dsView.Clear()

daView.Fill(dsView, "News")

cmdView.Dispose()

conView.Close()

TextBox1.DataBindings.Add("Text", dsView, "News.EnglishText")

TextBox2.DataBindings.Add("Text", dsView, "News.ArabicText")

Catch ex As Exception

MsgBox(ex.ToString())

End Try

End Sub

If your actions inspire others to dream more, learn more, do more and become more, you are a leader

Best Regards

Feras Abualrub

مواضيع مشابهة