I've got a combo box that I want to bind a collection to. I got the
error "Complex Data Binding accepts as a data source either an IList or
an IListSource" so I tried using the BindingSource, which works except
when I want to have a blank line as the first item in the combo
box--then all that is displayed is the type of object.
Here is the code for filling the collection:
Public Function GetCollection(B yRef cndb As SqlConnection, Optional
ByVal addBlank As Boolean = True, Optional ByVal activeOnly As Boolean
= True) As SingleKeyCollec tion(Of KeyType, ObjectType)
Try
'Wrap the collection in the wrapper to properly load from
XML
Dim coll As New CollectionWrapp er(Of KeyType, ObjectType)
'Be sure to convert all strings to db type paramaters using
db.todb()
coll = db.executeColle ctionReader(cnd b,
db.buildCommand (cndb, SP_GETS, PARAM_ACTONLY, activeOnly), coll)
If IsNothing(coll) Then
coll = New CollectionWrapp er(Of KeyType, ObjectType)
End If
'If addBlank is true add a null ent
If addBlank Then
Dim blank As ObjectType =
Activator.Creat eInstance(GetTy pe(ObjectType))
With blank
.SetKey(CType(N ULL_KEY_VALUE, KeyType))
.IsActive = True
.IsActiveSpecif ied = True
End With
'add the blank to the front of the collection
If coll.Items.Coun t = 0 Then
coll.Items.Add( blank)
Else
coll.Items.Inse rt(0, blank)
End If
End If
'return the collection
Return coll.Items
Catch ex As SQL_GerneralExc eption
Throw New BL_SQLException (ex.Message)
Catch ex As SQL_UnknownSQLE xception
Throw New BL_SQLException (ex.Message)
Catch ex As Exception
Throw New BL_GeneralExcep tion(ex.Message )
End Try
End Function
Here is the code where I'm trying to fill the combo box:
Public Overridable Sub SetDropDowns(By Val groupTitleColle ction As
SingleKeyCollec tion(Of Integer, ContactGroupTit le_BO))
Dim bindingsource1 As New BindingSource
'Set the grouptitle datasource
'Me.cboGroupTit le.DisplayMembe r = "DisplayVal ue"
'Me.cboGroupTit le.ValueMember = "Key"
bindingsource1. DataSource = groupTitleColle ction
Me.cboGroupTitl e.DisplayMember = "DisplayVal ue"
Me.cboGroupTitl e.ValueMember = "Key"
cboGroupTitle.D ataSource = bindingsource1
End Sub
Now when I call the GetFunction to create a collection and I pass in
false for the optional parameter addBlank, the values I expect to be
displayed in the combo box are displayed but I want a blank line as
users don't always want to select a value and when I pass in true for
the optional parameter, then the type of groupTitleColle ction is
displayed (and in this example, it's
BusinessLogic.C ontractGroupTit le_BO. Any suggestions of what needs to
be changed?
Thanks.
Molly J. Fagan 0 1964 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dan glenn |
last post by:
Hi. I'm finding that if I have text entered into a
<textarea ...> </textarea> in a form, and that text
has leading blank lines (with no spaces or anything
else), that when I retrieve the entered text, I
lose the leading blank line. Each time it goes through
a post any top-leading blank line is lost. Only one-
if I have several blank lines in a row at the top,
only the first is lost. (If the top blank line has
a single space, it's handled...
|
by: yanakal |
last post by:
Hi,
I'm using isql to query data and output the same to a flat file.
The isql has the following command options ' -h-1 -w500 -n -b -s"" '.
In the SQL_CODE, the first two lines before the select statement are
use dbname
set nocount on
go
When I run this, an additional blank line is put into the output file.
Actually, there are two lines after the last result set in the output
file. This file is being fed into another system and the...
|
by: srinivas |
last post by:
Hi all,
I have one requirement.Is there any way to create a line graph
using javascript.If it is please send me the sample code.But the thing
is it should work in all browsers.
Thanks,
Srinivas
|
by: ChadDiesel |
last post by:
My basic question is why does my print report button on my subform print a
blank report when my cursor is on a blank entry line? Here is a more
detailed explanation of my problem.
I have a form that contains shipment destination information and a subform
that contains boxes for that shipment. The main form is a table called
Ship_Info, and the subform is a table called Label_Info. They both contain
and are linked by a field called...
|
by: dave.dolan |
last post by:
Basically I'd like to implement the composite design pattern with leaves that
are either of reference or value types, but even using generics I can't seem
to avoid boxing (using ArrayList or Object)
Is this even possible, or is the composite pattern doomed to use the
System.Object type forever?
I have tried using interfaces with generics, but I always stumble on the
Value property (when trying to return the value of a particular node)
| |
by: Joy M |
last post by:
Hello,
I am modifying an .asp file and I noticed that the top line on the screen is
blank. I would like to remove this line, and push everything up to the top
of the screen, but I don't know what is causing it to appear. Does any one
have any ideas of what to look for?
The code has <table><tr><tdtags. There are no <formand no <p>. I hope
I have given you enough information, and thank you for your help.
|
by: Timur Tabi |
last post by:
Is there a way I can have the browser automatically insert a blank
line after each definition in a definition list? Right now I have
this:
term-1
definition text ....
term -2
definition text ...
I'd like to have this:
|
by: nev |
last post by:
Good day to all! I was trying to search the internet about this problem but I still can't seem to stumble upon an answer.
I am using a BindingSource on my program and everything is ok except that the users can edit any record they want before saving them all in one click. Well, this is fine when doing common saves. But, in my program, I have placed validations for each particular fields.
When I add or edit a record then save, the...
|
by: brian mccallum |
last post by:
My PHP code is generating XML with a blank first line before the <?xml version="1.0" ?>
see http://urbanbees.co.uk/maps/phpsqlajax_genxml3.php
I have been told this is the reason why my map is not showing the markers in chrome and FF but it is OK in IE8. see http://urbanbees.co.uk/maps/map_of_hive_locations_update.htm You'll either see markers or not depending on your broswer.
How do I change the code to not generate this first blank...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |