473,770 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PROBLEM:"Cannot modify the Items collection when the DataSource...

Hello
I have a listbox with a datasource.I want to remove a row from listbox but
not remove it from the database.
How can i do this ?

PROBLEM:"Cannot modify the Items collection when the DataSource property is
set."
Nov 21 '05 #1
1 4043
Hi VictorJOL,

I use the next code to connect with the database and load the listbox
control with the data of this db. (I connect, bind the data and disconnect)

Dim strConexion As String
Dim objConexion As OleDbConnection
Dim objComando As OleDbDataAdapte r
Dim objDS As New DataSet
strConexion = "PROVIDER=MICRO SOFT.JET.OLEDB. 4.0;" & "DATA SOURCE=" &
"C:\Ejemplo.mdb "
objConexion = New OleDbConnection (strConexion)
objComando = New OleDbDataAdapte r("Select * From Tabla", strConexion)
objComando.Fill (objDS, "Ejemplo")
Dim Row
Dim Fila As DataRow
'intContador = 1
ListBox1.Items. Clear()
For Each Row In objDS.Tables("E jemplo").Rows
ListBox1.Items. Add(Row(0))
Next
objConexion.Clo se()
Later, I remove an element of the listbox control, but the connection with
the db, is switch off.

ListBox1.Items. RemoveAt(2)

I hope that helps.

Kind Regards,

Jorge Serrano Pérez
MVP VB.NET
"VitorJOL" wrote:
Hello
I have a listbox with a datasource.I want to remove a row from listbox but
not remove it from the database.
How can i do this ?

PROBLEM:"Cannot modify the Items collection when the DataSource property is
set."

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1919
by: joseph | last post by:
When I perform "Copy Project" in VS.NET 2003 sometimes I got "Unspecified Error" error in a pop-up. My colleague also has this problem. Is it something to do with the network or to do with SourceSafe? Thanks
2
2026
by: ksskumar2000 | last post by:
Hi, I have added following two reference under COM tab, Microsoft Office 11.0 Object Library Microsoft Word 11.0 Object Library The software I have used: Visual studio 1.14 Microsoft Office 2003
0
2988
by: maxim mat | last post by:
Hi I need to build client for web service. But when I'm using Visual Studio .NET to add Web Reference, I get error: "Custom tool error: Unable to import WebService/Schema. Unable to import binding 'controllerSoapBinding' from namespace 'http://Bla-Bla-Bla'. Unable to import operation 'getClient'. The datatype 'Array' is missing. " Some problem when I try to use wsdl.exe tool in .NET. I get: Schema validation warning: Type 'cww:Class' is...
0
1959
by: Chun | last post by:
Dear All I am now facing a problem when i try to pass a custom datatable datatype value to a remote server. In the remote server, a method with System.Data.DataTable as input parameter is implemented. An error "Cannot be converted into parameter type System.Data.DataTable". Please help to provide me a solution for my problem. Thank you for your kind support.
1
1840
by: kimso.zhao | last post by:
Hi all, When I tried reading user command from console, I use "select" to wait for user input in order to improve efficiency. But when it comes to dealing with user pasting a command, there is a problem. Only the first character of the pasted command can be displayed. But the command is actually there, if you typed any one more key, the whole pasted command will be displayed. Here is the code. Do you have any way to get through this?...
10
21826
by: Ole | last post by:
Hi, Using VS2005 and a windows CE 5.0 device running CF2. Suddenly I can't debug my C# program from VS2005 - when setting a breakpoint I only see a ring instead of the normal red dot and when holding the mouse over it I see a message saying: "The breakpoint will not currently be hit. The specified module has not been loaded". I have no problem when debugging a normal full framework application. I have not changed anything in my settings...
1
5736
by: mike11d11 | last post by:
Can anyone Tell me why this code doesnt let me bind a Textbox field to the Account# column in my SQL table. It says "Cannot bind to the property or column ACCOUNT# on the DataSource. Parameter name: dataMember" I've been looking around and some people have been using the currency manager. If this is a solution could someone show me how I can add it to my code to make my binding work correctly. thanks Public Class Form1
4
2979
by: Waldy | last post by:
Hi there, does anyone know the cause of this problem. When I press F5 to debug a C# web application, I get an error message that begins "Cannot create/shadow copy " then various different file names. Sometimes I can debug, other times I get the message above. Regards, Steve W.
0
2622
by: jb489 | last post by:
Hi all, Hope I am posting this in the right forum. I seem to be having a problem when using serialization and web services. <b>Scenario:</b> I have built a web service which includes a multitude of web methods. All the web methods have various parameters, but one parameter which they all have in common is an 'object' parameter. This is due to the fact that the web service works differently according to the type of object being...
0
9454
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
10257
Oralloy
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...
1
10037
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
8931
agi2029
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...
1
7456
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
6710
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
5354
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...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.