473,756 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.NET Late-binding problem

chathura86
227 New Member
Hi
i have bounded a dataset to a listbox and i want to get the selected values when i clicked add and write them to a text box. here is the code i'v used

Expand|Select|Wrap|Line Numbers
  1. Imports System.Data.SqlClient
  2.  
  3. Public Class frmContactList
  4.     Private conContacts As SqlConnection
  5.     Private cmdContacts As SqlCommand
  6.     Private dtaContacts As SqlDataAdapter
  7.     Private dtsContacts As DataSet
  8.  
  9.     Private Sub frmContactList_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
  10.         txtNumberList.Text = frmSendSMS.txtTo.Text
  11.  
  12.         conContacts = New SqlConnection("Data Source=localhost;Initial Catalog=ABC;Integrated Security=True")
  13.         cmdContacts = New SqlCommand("SELECT ('<' + PHONE_MOBILE + '> ' + TITLE + '. ' + F_NAME + ' ' + L_NAME) AS NAME, PHONE_MOBILE AS MOBILE FROM CONTACTS", conContacts)
  14.         dtaContacts = New SqlDataAdapter
  15.         dtsContacts = New DataSet
  16.  
  17.         dtaContacts.SelectCommand = cmdContacts
  18.  
  19.         Try
  20.             conContacts.Open()
  21.             dtaContacts.Fill(dtsContacts, "CONTACTS")
  22.         Catch ex As Exception
  23.             MessageBox.Show(ex.Message.ToString)
  24.         Finally
  25.             conContacts.Close()
  26.         End Try
  27.  
  28.         lstContacts.DataSource = dtsContacts.Tables("CONTACTS")
  29.         lstContacts.DisplayMember = "NAME"
  30.         lstContacts.ValueMember = "MOBILE"
  31.     End Sub
  32.  
  33.     Private Sub btnSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click
  34.         frmSendSMS.txtTo.Text = txtNumberList.Text
  35.         Me.Close()
  36.     End Sub
  37.  
  38.     Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click, lstContacts.DoubleClick
  39.         For i As Integer = 0 To lstContacts.Items.Count - 1
  40.             If lstContacts.Items(i).Selected Then          'Error comes here
  41.                 txtNumberList.Text += lstContacts.Items(i).Text & ";"
  42.             End If
  43.         Next
  44.     End Sub
  45.  
  46.     Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
  47.         txtNumberList.Text = ""
  48.     End Sub
  49. End Class
  50.  
when i run the program it loads the values in to the listbox.but when i select a item and press the add button it gives an error (something about late-binding)

Error:
Missing Member Exception was unhandled
Public member 'Selected' on type 'DataRowView' not found.


please tell me how to fix this or is their a better way to do this?

chathura
Oct 18 '07 #1
4 2170
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
could you please point to the line at which the error is thrown,
and be specific rather than "some kind of error" .. dosent help us anyways, and neither will it to you
Oct 18 '07 #2
chathura86
227 New Member
could you please point to the line at which the error is thrown,
and be specific rather than "some kind of error" .. dosent help us anyways, and neither will it to you
Error is in the line 40 it is indicated with a comment also.
and the error message i'v got is mentioned under "Error:"

Thank you.
Oct 18 '07 #3
Shashi Sadasivan
1,435 Recognized Expert Top Contributor
you mean to say that there is no other description of the error!!!!

could you please let us know what kind of datatype is "lstContact s"

It is not declared in the code sniuppet provided by you (Sorry if i missed the fine print amongst the haystack there)
Oct 18 '07 #4
chathura86
227 New Member
you mean to say that there is no other description of the error!!!!

could you please let us know what kind of datatype is "lstContact s"

It is not declared in the code sniuppet provided by you (Sorry if i missed the fine print amongst the haystack there)
it's ok i should have mentioned line nuber cz it is bit hard to see.

Visual Studio 2005 givs the following tip:
*************** *************** *************** **
if a member in a class library has been moved, recompile any assemblies that reference that library.
if you are atempting to access members on a late-bounded object variable, make sure it is declared public.
*************** *************** *************** **

lstContact is ListBox which i draged and droped into the form. must say that im not very good with vb

is there a way to early bind this listbox. but may have to change the sql query on runtime to get different items to the listbox accoring to a query which can be typed on a textbox
Oct 18 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2268
by: MarionEll | last post by:
--------------------------------------------------------- ************* Call for Participation ************** ************ Late Breaking News ************* *********** Extreme Markup Languages 2003 ************ --------------------------------------------------------- The regular (peer reviewed) part of the Extreme 2003 program has been scheduled. As usual, we have reserved a few slots on the Extreme program for...
0
1664
by: MarionEll | last post by:
XML Conference 2003 program now available…register with discounts now! IDEAlliance has just released the full program for XML 2003 scheduled December 7-12 at the Philadelphia Convention Center. This year's event is chock full of sessions on Web Services, Publishing, Client Applications, Core Technologies, Knowledge Management, Government Applications, Vertical Industry Case Studies, and more. See the schedule at a glance for more...
0
1559
by: melledge | last post by:
Deadline for XTECH 2005 Late-Breaking News and Vendor Presentations - 28 March The deadline for submission of Late-Breaking News and Vendor Presentations for IDEAlliance's XTCH 2005 http://www.xtech-conference.org is Monday, 28 March. Please visit http://www.xtech-conference.org/2005/call.asp for submission information and guidelines.
2
4376
by: hazz | last post by:
how do I do this? I am certain my Visual Studio .NET solution allowed me to do this before but I don't know how the build/debug settings were configured. In order to get around an unavoidable circular reference constraint, Activator.CreateInstance was employed in the project. But now when I run through in debug mode, breakpoints are ignored in the late bound object. If I were the late bound object I would probably tell the runtime to...
1
2012
by: Daniel | last post by:
How do I call a delegate in late bound C# dll? there some way to do this w/ a sharedinterface file? any examples? i tried this but it doesnt work: (oType.GetMethod("IOCTLJOB").Invoke(pObj, new object { pClass1.m_job } )).ToString(); and it returns the error: Additional information: Object type cannot be converted to target type.
1
1997
by: jai | last post by:
I need to find the average number of days late for each supplier, each hav more than one order. how can i group the suppliers orders and find the average :S shud i do this in a report? i have worked out the number of days late for each order using DateDiff function
32
2690
by: whiteboy | last post by:
What's up Everyone? I really need some help. I've been pulling the hair out of my head trying to research how to calculate a late date. Here is what I'm trying to do: DATE VOUCHER SUBMITTED: 1 MAY 06 VOUCHER LATE?: YES
2
2354
snowman67
by: snowman67 | last post by:
I am writing an RFQ for a software to support my alternativecancer.us web site and need to add a late clause. I haven’t seen any, but I was thinking of a 1% penalty for the first week late and adding 1% to the penalty every week so if not delivered until after the second week the penalty is 2%…. Has anybody seen any late penalties in a development contract? If so, how was the penalty structured? I expect the development of this software to...
13
2481
by: Wayne | last post by:
I have just experienced my first late paying client. By "late" I mean that the invoice is now almost 2 months overdue. I don't think that the client is maliciously withholding payment - rather there has been an unfortunate series of events which has delayed the payment. The bottom line for a small time developer is still the same however. I am confident that I will receive payment for the invoice eventually but it is now a case of "once...
0
1313
by: efftronics | last post by:
Hi, My question is when i log on as a domain user in a computer, which is under domain i am getting very late. What are the reasons for that late. It takes more time for APPLYING YOUR PERSONAL SETTINGS. send replies as early as possible. Thanking you,
0
9271
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9869
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...
1
9838
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9708
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
7242
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
6534
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
5140
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...
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
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.