Hopefully someone can help me on this.
I am using C#, making Windows forms.
I have created a listView with checkbox's. I have enabled the checkboxes
under the properties, and all the data, checkbox's and icons are displayed
as they are meant to be. My problem is this, I am trying to achieve the same
results as I get with CheckListBox(s), where I am able to select
(Check-mark) various checkboxs items and able to alter the data. I do prefer
to use ListView because of adding icons, view properties, sizing, etc.
A sample of my code is below where I am trying to grab my selected (checked)
items then convert the name with my inputted text name:
foreach(string myItem in this.lvMassFileConversion.CheckedItems)
{
string myItem2 = this.txtBoxNameConvsersion.Test + " - " + myItem;
//Over-write old file with new file
File.Move(Path.Combine(currentFolderPath.myItem).P ath.Combine(currentFolderP
ath.myItme2)
}
Now I can achieve the required results with checklistbox, but because of the
above mentioned I'd like to stay with listview.
Thank you all in advance.
MikeY 3 9258
Hi Mike,
I understand that you are using a list view control with checkboxes besides
each item in the list. But i am unable to get what the exactl problem is. Do
you want the user to be able to edit the items at run time [OR] do you want
to change the contents of the list programatically?
User editing scenario: The list-view supports in-place editing of its items.
Just set the LabelEdit property to true. Look at http://msdn.microsoft.com/library/de...ledittopic.asp
for more info.
Programatic updations: You can use the ListView_SetItemText(iItemNumber,
iSubItemNumber, blah,blah) macro to set/reset the item and sub-item texts.
To update the item contents, set the iSubItemNumber to zero. Look at http://msdn.microsoft.com/library/de...etitemtext.asp
for more info.
If this is not what you want, please write back explaining the issue.
Thanks,
Devi J V [MSFT]
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"MikeY" <mi*******@yahoo.c> wrote in message
news:wG*******************@news20.bellglobal.com.. . Hopefully someone can help me on this.
I am using C#, making Windows forms.
I have created a listView with checkbox's. I have enabled the checkboxes under the properties, and all the data, checkbox's and icons are displayed as they are meant to be. My problem is this, I am trying to achieve the same results as I get with CheckListBox(s), where I am able to select (Check-mark) various checkboxs items and able to alter the data. I do prefer to use ListView because of adding icons, view properties, sizing, etc.
A sample of my code is below where I am trying to grab my selected (checked) items then convert the name with my inputted text name:
foreach(string myItem in this.lvMassFileConversion.CheckedItems) { string myItem2 = this.txtBoxNameConvsersion.Test + " - " + myItem; //Over-write old file with new file
File.Move(Path.Combine(currentFolderPath.myItem).P ath.Combine(currentFolderP ath.myItme2) }
Now I can achieve the required results with checklistbox, but because of the above mentioned I'd like to stay with listview.
Thank you all in advance.
MikeY
Hi Devi,
I was thinking after I posted my question that I might not of gotten the
point across.
My application pulls all my files *.txt, *.mp3, etc from a folder. Where it
is displayed with in my ListView (lvMassFileConversion), with checkboxs.
From there the user is able to check-mark the required checkbox's in order
to change their names of the files(append). This happens when the user then
inputs a new name with in a textbox (txtBoxNameConvsersion) and clicks the
conversion button. The checked files then are all renamed (appended). All
the syntax happens with in the Conversion button function. This all takes
place at run-time.
The syntax that I previously posted (but forgot to mention) is the syntax
from when I use the CheckListBox. Now this works just fine (using the
CheckListBox) and I am able to get the exact results that I want, using the
same scenario. But I don't want to use the CheckListBox, because of
previously posted reasons, size, etc. The code I posted was me trying to
modify the syntax to use with my ListView instead, but did not work.
Thanks for the links, but didn't see what I was looking for.
Hopefully I am making more sense over my morning coffee. Any & all help is
appreciated.
MikeY
"Devi JV [MSFT]" <de****@online.microsoft.com> wrote in message
news:ut**************@tk2msftngp13.phx.gbl... Hi Mike,
I understand that you are using a list view control with checkboxes
besides each item in the list. But i am unable to get what the exactl problem is.
Do you want the user to be able to edit the items at run time [OR] do you
want to change the contents of the list programatically?
User editing scenario: The list-view supports in-place editing of its
items. Just set the LabelEdit property to true. Look at http://msdn.microsoft.com/library/de...ledittopic.asp for more info. Programatic updations: You can use the ListView_SetItemText(iItemNumber, iSubItemNumber, blah,blah) macro to set/reset the item and sub-item texts. To update the item contents, set the iSubItemNumber to zero. Look at http://msdn.microsoft.com/library/de...etitemtext.asp for more info.
If this is not what you want, please write back explaining the issue.
Thanks, Devi J V [MSFT]
-- This posting is provided "AS IS" with no warranties, and confers no
rights.
"MikeY" <mi*******@yahoo.c> wrote in message news:wG*******************@news20.bellglobal.com.. . Hopefully someone can help me on this.
I am using C#, making Windows forms.
I have created a listView with checkbox's. I have enabled the checkboxes under the properties, and all the data, checkbox's and icons are
displayed as they are meant to be. My problem is this, I am trying to achieve the same results as I get with CheckListBox(s), where I am able to select (Check-mark) various checkboxs items and able to alter the data. I do prefer to use ListView because of adding icons, view properties, sizing, etc.
A sample of my code is below where I am trying to grab my selected (checked) items then convert the name with my inputted text name:
foreach(string myItem in this.lvMassFileConversion.CheckedItems) { string myItem2 = this.txtBoxNameConvsersion.Test + " - " + myItem; //Over-write old file with new file
File.Move(Path.Combine(currentFolderPath.myItem).P ath.Combine(currentFolderP ath.myItme2) }
Now I can achieve the required results with checklistbox, but because of the above mentioned I'd like to stay with listview.
Thank you all in advance.
MikeY
Hi Mike,
My apologies for the delayed response. Let me re-state the problem for
better understanding of its solution:
The problem:
The application UI has a List View control and a Text Box and a Button. The
list view displays a list of files with checkboxes besides each file name.
If the user wants to modify the names of certain files, he selects those
files [by checking the corresponding checkboxes] , enters some text in the
text box and then clicks on the button. Now your application should update
all the checked file names with the text in the text box.
The solution:
Let's make certain things clear before i show you the sample code.
1. The ListView.CheckedItems property returns a
CheckedListViewItemCollection.
2. Each object in the collection is a ListViewItem and not a string.
For more info on this see http://msdn.microsoft.com/library/de...classtopic.asp
3. The filename of [let's say] the first file in the list is the text
property of the first item in the list view. Hence it should be accessed as
ListViewItem.Text
For more info on this http://msdn.microsoft.com/library/de...classtopic.asp
Hence to loop through the items in the collection and update the filename,
you should use something like this:
Sample code:
//get all the checked items in the list
ListView.CheckedListViewItemCollection checkedItems =
this.lvMassFileConversion.CheckedItems;
//for each checked item
foreach ( ListViewItem myItem in checkedItems )
{
//get the new filename
string myFileName = this.txtBoxNameConvsersion.Text + "-" +
myItem.Text;
// do your file name updation here. Remember, myItem.Text gives you
the filename [myItem given you the entire list view item]
}
To understand more about what a list view control is and how it behaves, you
can look at http://msdn.microsoft.com/library/de...classtopic.asp
and http://msdn.microsoft.com/library/de...w_overview.asp
or you can search msdn for a 'listview control'
Thanks,
Devi JV [MSFT]
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm
"MikeY" <mi*******@yahoo.c> wrote in message
news:CX*******************@news20.bellglobal.com.. . Hi Devi,
I was thinking after I posted my question that I might not of gotten the point across.
My application pulls all my files *.txt, *.mp3, etc from a folder. Where it is displayed with in my ListView (lvMassFileConversion), with checkboxs. From there the user is able to check-mark the required checkbox's in order to change their names of the files(append). This happens when the user then inputs a new name with in a textbox (txtBoxNameConvsersion) and clicks the conversion button. The checked files then are all renamed (appended). All the syntax happens with in the Conversion button function. This all takes place at run-time.
The syntax that I previously posted (but forgot to mention) is the syntax from when I use the CheckListBox. Now this works just fine (using the CheckListBox) and I am able to get the exact results that I want, using the same scenario. But I don't want to use the CheckListBox, because of previously posted reasons, size, etc. The code I posted was me trying to modify the syntax to use with my ListView instead, but did not work.
Thanks for the links, but didn't see what I was looking for.
Hopefully I am making more sense over my morning coffee. Any & all help is appreciated. MikeY
"Devi JV [MSFT]" <de****@online.microsoft.com> wrote in message news:ut**************@tk2msftngp13.phx.gbl... Hi Mike,
I understand that you are using a list view control with checkboxes besides each item in the list. But i am unable to get what the exactl problem is. Do you want the user to be able to edit the items at run time [OR] do you want to change the contents of the list programatically?
User editing scenario: The list-view supports in-place editing of its items. Just set the LabelEdit property to true. Look at http://msdn.microsoft.com/library/de...ledittopic.asp for more info. Programatic updations: You can use the ListView_SetItemText(iItemNumber, iSubItemNumber, blah,blah) macro to set/reset the item and sub-item texts. To update the item contents, set the iSubItemNumber to zero. Look at http://msdn.microsoft.com/library/de...etitemtext.asp for more info.
If this is not what you want, please write back explaining the issue.
Thanks, Devi J V [MSFT]
-- This posting is provided "AS IS" with no warranties, and confers no rights.
"MikeY" <mi*******@yahoo.c> wrote in message news:wG*******************@news20.bellglobal.com.. . > Hopefully someone can help me on this. > > I am using C#, making Windows forms. > > I have created a listView with checkbox's. I have enabled the > checkboxes > under the properties, and all the data, checkbox's and icons are displayed > as they are meant to be. My problem is this, I am trying to achieve the > same > results as I get with CheckListBox(s), where I am able to select > (Check-mark) various checkboxs items and able to alter the data. I do > prefer > to use ListView because of adding icons, view properties, sizing, etc. > > A sample of my code is below where I am trying to grab my selected > (checked) > items then convert the name with my inputted text name: > > foreach(string myItem in this.lvMassFileConversion.CheckedItems) > { > string myItem2 = this.txtBoxNameConvsersion.Test + " - " + myItem; > //Over-write old file with new file > > File.Move(Path.Combine(currentFolderPath.myItem).P ath.Combine(currentFolderP > ath.myItme2) > } > > Now I can achieve the required results with checklistbox, but because > of > the > above mentioned I'd like to stay with listview. > > Thank you all in advance. > > MikeY > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ncookson |
last post by:
I am trying to add a caption or title to the box drawn around a
checklistbox and having no luck. Is there a way to do this?
I am using python 2.3.4 and wxPython 2.5 on a windows platform.
Noel
|
by: Bernie Yaeger |
last post by:
Is there any way to get a listbox or a checklistbox behave in an
autocomplete manner, such that given 'two', 'three', 'water', 'them' would
bring the selection to 'two' (not 'water') when I key in...
|
by: MikeY |
last post by:
Hi all,
I am coding window forms in C#.
My problem is this: I have created a "Check ListView" or a 'ListView' with
checkbox's. I have populated the it with my files from my folders, mps, txt,...
|
by: comic_rage |
last post by:
Hi,
I created a checkListBox to allow the user to select and place a check
next to multiple items in the GUI. I would like to add a 2 column where
the first column show the description of the...
|
by: Mike Kim |
last post by:
hi all,
i have a checklistbox populated with about 50 items from database. and on
the same form, i added to button to do the following.
if you click this button, i want to have all items in the...
|
by: Ville Mattila |
last post by:
Dear readers,
I've some problems with the data binding of the checklistbox control.
I'm using it with user preferences that are stored in a XML File.
Information from the file is fetched with...
|
by: obrienkev |
last post by:
Hi,
I want to mark the CheckListBox items as Checked based on a database query.
So the CheckListBox items should be checked if each item matches fundsAffected field from the below query...
...
|
by: obrienkev |
last post by:
Hi all,
How do I mark an item in a checklistbox as checked based on a condition?
e.g.
if(x=1)
{
// SET a ChecklistBox Item as Checked
}
|
by: khalidjan9 |
last post by:
I have data in an arraylist and i want to add data to checklist box on runtime and i also want to display a textbox besides it so that i get the comments
example :
checklistbox "text" textbox...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
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...
| |