|
-
Feb 26th, 2004, 09:40 PM
#1
Thread Starter
PowerPoster
Combobox bound to dataset [Resolved}
Hi,
I have just had a problem getting a combobox to correctly display bound data.
Eventually I discovered that when specifying the DisplayMember property, I had to use the exact case used in the spelling of the database field. If I use the wrong case for any letter I the displayed item was "System.Data.DataRowView"
Is this normal?
Last edited by taxes; Feb 27th, 2004 at 05:02 PM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Feb 26th, 2004, 11:16 PM
#2
Yes the databinding needs to be case sensitive that includes DisplayMember, ValueMember and others like them.
I believe Databinding uses reflection to display the choosen property and reflection is by default case sensitive. Here is an example:
VB Code:
'this assumes a button named btnReflect and a textbox named txtMember
'when the button is clicked it displays the value of the member named in the textbox
'(i.e. "Text" would equal the text for the button or in my case "&Reflect")
'Notice that it is by default case sensitive so "text" will return the type "Windows.Forms.Button"
Private Sub btnReflect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReflect.Click
MsgBox(String.Format("Property ""{0}"" equals ""{1}""", txtMember.Text, ReflectMember(btnReflect, txtMember.Text).ToString))
End Sub
Public Function ReflectMember(ByVal obj As Object, ByVal member As String) As Object
'get propery
Dim pi As Reflection.PropertyInfo = obj.GetType.GetProperty(member)
If pi Is Nothing Then
Return obj.GetType.ToString
Else
Return pi.GetValue(obj, Nothing)
End If
End Function
-
Feb 27th, 2004, 04:05 AM
#3
Thread Starter
PowerPoster
Combo Box Bound to dataset[ Resolved]
Hi Edneeis,
Many thanks. I certainly have not seen any comment to this effect in my books or MSDN (although I suspect it is there somewhere!)
If you see this, Could you please tell me how I can mark this thread "Resolved". I've tried every way I can think of, so it must be too obvious
Last edited by taxes; Feb 27th, 2004 at 12:12 PM.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Feb 27th, 2004, 10:46 AM
#4
To mark a thread resolved you have to edit your original post that started the thread and change its title to include [Resolved].
-
Feb 27th, 2004, 12:22 PM
#5
Thread Starter
PowerPoster
Combo box bound to dataset [Resolved]
Hi Edneeis,
I.ve tried that - I think!!
If you notice my previous post - and this one I hope - I have added [Resolved] to the subject box, but it has not registered in the forum page.
I take it that I should make the entry in the "Post Subject" box on the top left where it is marked "optional"?
I have used square brackets around "Resolved".
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Feb 27th, 2004, 01:13 PM
#6
You don't have to use brackets if you don't want. The thing is you put it in the Post Subject of your Reply but you have to go to your original post (the first one at the top of the thread) and press 'Edit' and then change that 'Post Subject' line. Then it will show in the list.
-
Feb 27th, 2004, 05:05 PM
#7
Thread Starter
PowerPoster
Hi Edneeis,
Wow! At last.
Many thanks.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Feb 27th, 2004, 05:11 PM
#8
No Problem. I was mystified about how they marked them resolved for a while too.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|