C# Checked List Box Checked Values only
How can I loop through a checked list box and get the values for the checked items only?
List<CheckedListBox> cbList = new List<CheckedListBox>();foreach (var item in checkedListBox.CheckedItems)
// Loops checked checkedListBox items cbList.Add(item);
}
Similar Messages
-
I have an iPhone 5s and in my iTunes music library have the songs checked that I want downloaded onto my phone. Instead of doing this, it is syncing all songs whether they are checked or not even tho I have the "sync only checked songs" box checked. So basically it's syncing all of the songs when I just want the checked ones on. This is very frustrating.
When your device is connected, check the tabs at the top ("Summary" "Apps" "Music," etc. Under the Music one, check to see if "Sync Music>entire music library" is checked. If it is, that may be why all the songs are syncing.
-
How to add a list box with values for a ztable in SM30
Hello Gurus,
I had created a table maintenance for Ztable and added many extra functionality to that. Now i would like to add a list box or check table for a field. Can i do that with out Regenerating my table maintenance. Please help me its..very urgent.Have referred this domain to the data element, this should be the Field type in ur table for the particular field.
Eg: <b>SE11 > table name > fields-ZTEST > fieldtype-ZZTEST</b>
ZZTEST in the data element > create a domain for this data element and in that specify teh value range.
Save and activate it.
Make sure that u regenerate teh table maintenance generator else u cant see the changes.
Now if u press F4 u can see only thevalues specified, also u will see only the list box with values in SM30.
Try this,please let me know if u face any difficulties. -
Multiple Select List Box default value ysing Fx or Code
Hello,
If anybody could help me in figuring out how to set default or customized values (checked) for a multiple select list box in infopath based on a values in a secondary data connection using the fx function or code, instead of manually typing in text in the
default value function, it would be really helpful. Have been stuck for eternity in this
I have a temp table now which has each student name and the subject separtely
something like this
Student Name Subject
AA
English
AA Maths
So that in my infopath form if I choose a student name in a drop
down box the multiple selection list box has the values of the subject chosen by the student checkedHi,
Please check the link below and see if it can meet your requirement:
http://basquang.wordpress.com/2010/03/29/cascading-drop-down-list-in-sharepoint-2010-using-infopath-2010/
Here is the design for your scenario:
List1 for subject name
List2 for student and subject (just as your temp table)
Then you could create cascading drop-down in InfoPath form.
Regards,
Rebecca Tu
TechNet Community Support -
List Box showing Value and Display members?
Ok this is a CONCEPT problem (the code is not professional, just read it for the concept, though it does compile and run).
Right, I have asked many people on IRC and no one is giving me a straight answer lol so maybe some professionals can help me.
I am trying to use a Datasource property for my combobox. This is so I can just pass an entire KeyValue pair with indexes and values to be shown in the listbox.
Creating the keyvaluepair as a WHOLE and passing that to datasource property works perfectly.
Creating a keyvaluepair PROCEDURALLY (in a loop or w/e) ends in the datasource property ToString()ing it, list box items show BOTH value AND display members in square brackets as an entire option.
NOTE: Getting the lsitbox.value results in ONLY the valuemember being returned even though the listbox shows both the valuemembers AND the displaymember? it knows they are different?
Now, I dont want any alternatives or comments about the quality of the code, all I want to know is WHY is it doing this, it seems compeltely illogical that the same TYPE and Values and can different Effects within the datasource property? Its like it knows
it was built procedurally?
Anyway here is some code for reference:
// Windows Form
namespace skbtInstaller
public partial class frmMainWindow : Form
public frmMainWindow()
InitializeComponent();
// coxArmaPath = Combo Box (simple drop down)
this.cBoxArmaPath.ValueMember = "Key";
this.cBoxArmaPath.DisplayMember = "Value";
public void addServerPathItem(String Key, String Value)
this.cBoxArmaPath.Items.Add(new KeyValuePair<String, String>(Key,Value));
// This works fine, only the "DisplayMember" is displayed and the "ValueMember" is hidden.
// This acts differently with the same types???
public void setServerPathDatasource(List<KeyValuePair<String, String>> source)
this.cBoxArmaPath.DataSource = new BindingSource(source, null);
public class skbtServerControl
private frmMainWindow frmMainWindowHandle;
public void refreshformWindow()
// Clear Drop Box (empties drop box)
this.frmMainWindowHandle.clearPathBox();
//skbtServerConfig is very simple property object
foreach (KeyValuePair<String, skbtServerConfig> pair in CoreConfig.getServerConfigList())
// Populate Drop Box
this.frmMainWindowHandle.addServerPathItem(pair.Key, pair.Value.getTextualName()); // this works as intended
// cBox gets items like: Some Display Text, Some Display Text, Some Display Text (PERFECT!)
// This works absolutely fine. ValueMembers are hidden.
public void refreshformWindowWithSTATICDatasource()
// Clear Drop Box
this.frmMainWindowHandle.clearPathBox();
var pathDataSource = new List<KeyValuePair<String, String>>()
new KeyValuePair<String, String>("testKey1", "somevalue1"),
new KeyValuePair<String, String>("testKey2", "somevalue2"),
new KeyValuePair<String, String>("testKey3", "somevalue3")
// Populate Drop Box
this.frmMainWindowHandle.setServerPathDatasource(pathDataSource);
// cBox gets items like: Some Display Text, Some Display Text, Some Display Text (PERFECT!)
// ** HERE IS THE PROBLEM?? **
// This creates a type that seems different to the above function which works fine...
public void refreshformWindowWithDatasource()
// Clear Drop Box
this.frmMainWindowHandle.clearPathBox();
var pathDataSource = new List<KeyValuePair<String, String>>();
//skbtServerConfig is very simple property object
foreach (KeyValuePair<String, skbtServerConfig> pair in CoreConfig.getServerConfigList())
pathDataSource.Add(new KeyValuePair<String, String>(pair.Key, pair.Value.getTextualName()));
// Populate Drop Box
this.frmMainWindowHandle.setServerPathDatasource(pathDataSource);
// cBox gets items like [asjAETJQ5785d45,Some Display Text], [asawfgQ5785d45,Some Display Text], [asjAhrrQ5785d45,Some Display Text]
// ????? surely this function should act exactly like the function above??
Thanks!
(I have posted on codeproject too, will condense any replies).
Thanks Michael!
I did debug this and it turns out when i set a new BindingSource to the combo box, indeed the DisplayMember gets reset. Oddly though, the ValueMember stays the same.
I have fixed this with setting the Members before every new bindingSource is set to the combobox, strange that only the displaymember is reset?
For reference, the new resolved code: (this compiles albeit with designer components placed)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace etstapp1
public partial class Form1 : Form
private skbtServerControl sc;
public Form1()
InitializeComponent();
this.sc = new skbtServerControl(this);
// coxArmaPath = Combo Box (simple drop down)
this.cBoxArmaPath.ValueMember = "Key";
this.cBoxArmaPath.DisplayMember = "Value"; // This doesnt seem to stick after the first datasource set??
public void addServerPathItem(String Key, String Value)
this.cBoxArmaPath.Items.Add(new KeyValuePair<String, String>(Key, Value));
// This works fine, only the "DisplayMember" is displayed and the "ValueMember" is hidden.
// This acts differently with the same types???
public void setServerPathDatasource(List<KeyValuePair<String, String>> source)
this.cBoxArmaPath.DisplayMember = "Value"; // fix datasource problem
this.cBoxArmaPath.ValueMember = "Key"; // fix datasource problem
this.cBoxArmaPath.DataSource = new BindingSource(source, null);
public void clearPathBox()
if(this.cBoxArmaPath.DataSource == null){
this.cBoxArmaPath.Items.Clear();
else
this.cBoxArmaPath.DataSource = null;
private void btnStatic_Click(object sender, EventArgs e)
this.sc.refreshformWindowWithSTATICDatasource();
private void btnNormal_Click(object sender, EventArgs e)
this.sc.refreshFormWindow();
private void btnDynamic_Click(object sender, EventArgs e)
this.sc.refreshformWindowWithDatasource();
public class skbtServerControl
private CoreConfig CoreConfig;
private Form1 frmMainWindowHandle;
public skbtServerControl(Form1 f){
this.frmMainWindowHandle = f;
this.CoreConfig = new CoreConfig();
public void refreshFormWindow()
// Clear Drop Box (empties drop box)
this.frmMainWindowHandle.clearPathBox();
//skbtServerConfig is very simple property object
foreach (KeyValuePair<String, skbtServerConfig> pair in CoreConfig.getServerConfigList())
// Populate Drop Box
this.frmMainWindowHandle.addServerPathItem(pair.Key, pair.Value.getTextualName()); // this works as intended
// cBox gets items like: Some Display Text, Some Display Text, Some Display Text (PERFECT!)
// This works absolutely fine. ValueMembers are hidden.
public void refreshformWindowWithSTATICDatasource()
// Clear Drop Box
this.frmMainWindowHandle.clearPathBox();
var pathDataSource = new List<KeyValuePair<String, String>>()
new KeyValuePair<String, String>("testKey1", "somevalue1"),
new KeyValuePair<String, String>("testKey2", "somevalue2"),
new KeyValuePair<String, String>("testKey3", "somevalue3")
// Populate Drop Box
this.frmMainWindowHandle.setServerPathDatasource(pathDataSource);
// cBox gets items like: Some Display Text, Some Display Text, Some Display Text (PERFECT!)
// ** HERE IS THE PROBLEM?? **
// This creates a type that seems different to the above function which works fine...
public void refreshformWindowWithDatasource()
// Clear Drop Box
this.frmMainWindowHandle.clearPathBox();
var pathDataSource = new List<KeyValuePair<String, String>>();
//skbtServerConfig is very simple property object
foreach (KeyValuePair<String, skbtServerConfig> pair in this.CoreConfig.getServerConfigList())
pathDataSource.Add(new KeyValuePair<String, String>(pair.Key, pair.Value.getTextualName()));
// Populate Drop Box
this.frmMainWindowHandle.setServerPathDatasource(pathDataSource);
// cBox gets items like [asjAETJQ5785d45,Some Display Text], [asawfgQ5785d45,Some Display Text], [asjAhrrQ5785d45,Some Display Text]
// ????? surely this function should act exactly like the function above??
public class CoreConfig
public Dictionary<String, skbtServerConfig> getServerConfigList(){
return new Dictionary<string, skbtServerConfig>()
{"somekey1", new skbtServerConfig("somename1")},
{"somekey2", new skbtServerConfig("somename2")}
public class skbtServerConfig
private String name;
public skbtServerConfig(String name)
this.name = name;
public String getTextualName()
return this.name;
Talking with someone it seems logical that every time I set a new BindingSource the component will not know if I want to keep the same member values so it resets them, but why it only resets displaymember? very strange to me.
Thanks again. -
- I have a Product list box (asp.net) used as multiple selected values for a parameter.
- The Product ID is defined in the Oracle procedure as NUMBER data type.
- In my crystal report, I have a parameter field allow multiple values as p_product_id type as Number. This is the code in my Record Selection Formula for the report:
({?p_product_id}[1] = -1 OR {Procedure_name.product_id} in {p_product_id})
- In C#, this is my code
List<decimal?> productUnit = new List<decimal?>();
int counter = 0;
decimal prod;
for (int i = 0; i < lstProducts.Items.Count; i++)
if (lstProducts.Items[i].Selected)
if (decimal.TryParse(lstProduct.Items[i].Value, out prod))
productUnit.Add((decimal?)prod);
counter++;
if (counter == 0)
productUnit.Add(-1);
ReportingDAO rDataFactory = new ReportingDAO();
retVal = rDataFactory.GetProductReport(productUnit);
public CrystalDecisions.CrystalReports.Engine.ReportDocument GetProductReport(List<decimal?> productUnit)
CrystalDecisions.CrystalReports.Engine.ReportDocument retVal = new rptProductDownload();
ReportLogon rptLog = new ReportLogon();
rptLog.Logon(retVal, "RPT_PRODUCT_DOWNLOAD");
retVal.SetParameterValue("p_product_id", productUnit);
I keep having the "Value does not fall within the expected range" when I debug. My question is, is the data type I used for procedure/Crystal report/ and C# correct ? I always have problem with the data type. Any help would be
appreciated
Thank youHi progGirl,
Thank you for your post, but Microsoft doesn't provide support for CrystalReport now. Please post your question in SAP official site here:
http://forums.sdn.sap.com/forum.jspa?forumID=313
Thank you for your understanding.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Table control list box. different values in each row of the list box
Hi all,
i have a requirement to display text box in table control. Each row of list box should contain different values.
i tried with the below code but the values are not getting populated in list box. please give your ideas.
I tried with list box which is having same values in all rows, it is working fine.
loop at itab.
select vbeln from ZSD_PS_BLAWB into ZSD_PS_BLAWB-vbeln
where BLAWBNO = itab-BLAWBNO and
BLAWBDT = itab-BLAWBDT and
CTRNO = itab-CTRNO.
if sy-subrc = 0.
index = 1.
list3-key = index.
list3-text = ZSD_PS_BLAWB-vbeln.
append list3 to list2.
index = index + 1.
endif.
endselect.
clear index.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
ID = 'ITAB-VBELN'
VALUES = list2
EXCEPTIONS
ID_ILLEGAL_NAME = 1
OTHERS = 2
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
modify itab.
endloop.
Thanks in advance.Hi,
this is code example for listbox
TYPE-POOLS vrm .
DATA: lt_vrm_values TYPE TABLE OF vrm_value.
DATA: wa_vrm_values TYPE vrm_value.
PARAMETER p_list AS LISTBOX VISIBLE LENGTH 10.
INITIALIZATION.
wa_vrm_values-key = 'Key1'.
wa_vrm_values-text = 'Value1'.
APPEND wa_vrm_values TO lt_vrm_values.
wa_vrm_values-key = 'Key2'.
wa_vrm_values-text = 'Value2'.
APPEND wa_vrm_values TO lt_vrm_values.
wa_vrm_values-key = 'Key3'.
wa_vrm_values-text = 'Value3'.
APPEND wa_vrm_values TO lt_vrm_values.
AT SELECTION-SCREEN OUTPUT.
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id = 'P_LIST'
values = lt_vrm_values
EXCEPTIONS
id_illegal_name = 1
OTHERS = 2.
IF sy-subrc 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
To fill it with data from DB, just do select in INITIALIZATION and put that values with same alghoritmus.
Manas M.
P.S.: This is very easy question, you should use search ... -
List Box-passing value from one jsp to another
I have a list box in a .jsp.
<SELECT name="name">
<option value ="Fred">Fred
<option value ="Michael">Michael
</select>
<input type="submit"
value="Names">
I need to send the name to another .jsp. I don't know how to receive it or send it. I am using form method="post". I need to use the name selected in a query in my next .jsp, so I can select all the data in that has that name in it. I am connecting to a database on the iseries. Do I have to use submit or can I use something else? I wanted to use a link like this.
<dt valign="left"><img src="bullet1.gif">
Volunteer</dt>
of course that didn't work.
ThanksI got it! Never mind!
-
Multicolumn list box, "operate value tool" and "active cell"
If I use the "operate value tool" to select a row
of the multicolumn list box, that row gets a dark blue background.
However, I cannot determine which property will tell me what is that row or let me
change that row number. It is not the active cel or "edit position".
I want to programatically change the selection just as the "operate value tool" does. I can change the background color of the cell but the dark blue of the cells selected by the "operate value tool" take precedence and hide my colors.
Extremely frustrated and wishing for Java or C++...
AlanHi Alan,
Have a look at event structures and invoke nodes (Point to Row Column) and use property nodes. Here is an attachment.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Attachments:
mclistbox.PNG 12 KB -
On button click of Infopath forms select multi select list box values...
Hi,
We have multi select list box on one of the info path forms. We have placed on button on this form. If user clicks on this button we want to select some of the values in Multi select list box (check box).
Is it possible if yes how can we achieve it?
Thanks.
Regards,
Amit ChhatbarHi Amit,
From your description, you would like to check items in a multi-selection box when a button is clicked.
I’d recommend you make use of rules in InfoPath form, i.e. when button is clicked, then set a field’s value.
However, if you are using multi-selection box, then you could only set the value of one item at a time. If you want to select several items at once, then we could use code. For more information:
http://www.bizsupportonline.net/blog/2009/07/understanding-multiple-selection-list-box-infopath/
http://www.bizsupportonline.net/infopath2007/programmatically-select-all-items-multi-select-list-box.htm
If you are using several check boxes to replace multi-selection box, then it will be more easy. The rule could be that when this button is clicked, set a field’s value (check box field) to true and repeat it.
Regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected] .
Rebecca Tu
TechNet Community Support -
i am populating a list box with Id's and names from a database and im trying to get the values from the list box depending what the user chooses, i.e if they choose the first choice in the list box the value i want to put in a variable is 1, etc
here is the code for the list box, please help
<select name="lstFilm" size="1">
<%while (result4.next())
{%>
<option value="<%result4.getInt(1);%>">
<%out.println(result4.getString(2));%>
</option>
<%}%>
</select>String[] lstFilm = request.getParameterValues("lstFilm");
Of course, it'll only return selected values. It'll be whatever the option values are. -
Retaining List Box Value in Form Bean
Hi All,
I want to retain the List Box populated using the Form bean.
Right now when i display the List Box in a page and submit the Form and come back
to same page again I do not get List Box populated.
In the JPF I do not get the all values of the List Box. I only get the selected
value of the ListBox.
Thx
HiteshHi sudha,
1. We can also use the FM
F4IF_INT_TABLE_VALUE_REQUEST
(here u will be able to capture the value)
2.
DATA : BEGIN OF itab OCCURS 0,
bukrs LIKE t001-bukrs,
butxt LIKE t001-butxt,
END OF itab.
SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE itab.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'BUKRS'
value_org = 'S'
dynprofield = 'MYLISTTAB'
dynpprog = sy-repid
dynpnr = sy-dynnr
TABLES
value_tab = itab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
3. In pai module,
use the code :
PROCESS ON VALUE-REQUEST.
field mylistab module abc.
where field = your field name
abc = module name (which contains the above coding in step 2)
regards,
amit m.
Message was edited by: Amit Mittal -
hi
is there any check list item (multi value lest item) in oracle forms 6i ......?Hi
Full example and more* u can find here ..._
Re: Dependent drop down lists in forms 6i
Hope this helps...
Regards,
Amatu Allah. -
IT Check Lists - Server rooms etc. Do you use them?
Hi all.
I was just wondering if most of you use a check list for checking service, servers, hardware etc.
If so please can I have some examples if you have any.
Thanks in advance
Stefan
This topic first appeared in the Spiceworks CommunityI just solved thememory issue, but now a new issue emerged. I couldn't save a new Excel file on my computer. Here is the detials of the problem.After I open a blank file, no matterr with or without any data on it, I click on File - Save As - Computer - Browse, nothing happens.1. This occurs only on my Lenovo laptop.2. The total RAM is 8GB, and the operating system on this laptop is 64-bit.3. Windows 8.1 + Office Professional Plus 20134. After a fresh boot, I still have this problem when using Excel spreadsheets ONLYThe things I have tried includes- repaired Office, no improvement- check to make sure Windows is updated.- replaced VBE7.DLL file with one from another computer- try to use VBA to save the workbook, failed. Below please see the message poped out.If I open a blank Excel file first, and then try to open an existed...
-
Dear All,
I am using the F4IF_INT_TABLE_VALUE_REQUEST this FM for filling the list box .Now i want to set default value in the list box
Example-
Supose i have 2 List box A & B and in list box i have to set default value in A list box X value and in B list box Y value .
X and Y value is coming in the list box from the master table .
Thanks & RegardsCode Snippet for your referance:
*F4 Help for Output Type
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KSCHL
DATA: l_repid TYPE syrepid,
l_dynnr TYPE sydynnr.
MOVE: sy-repid TO l_repid,
sy-dynnr TO l_dynnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'KSCHL'
dynpprog = l_repid
dynpnr = l_dynnr
dynprofield = 'P_KSCHL'
window_title = text-001
value_org = 'S'
TABLES
value_tab = it_value_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3
Maybe you are looking for
-
How to load data from a virtual cube with services
Hello all, we have set up a virtual cube with service and create a BEx report to get the data from an external database. That works fine. The question is now: Is it some how possible to "load" the data from this virtual cube with service (I know that
-
Hi all I can create Buttons in an Applet, make them usable, make them disappear, but how the hell can i mek them reappear when i don't want them to there all the time. the "add" method did not work for that, at least not outside the init() context. b
-
Is it possible to use charecterestic used in formula variable
Got a boolean logic in a formula of the structure in BEx, i could create a formula variable for date , it works .However, i have to bring payment method into the logic ,( e.g.. if the payment method is 'C'-weekly then late payment logic is different
-
Backng up failed with return code 255 ...Help!!!
Hi, I am in a process of backing up Oracle application server 10g through "Configure Backup/Recovery Settings" feature of the app server, when I provide the directories for: 1. Log File Location 2. Configuration Files Backup Location 3. Met
-
I try to send a message to a contact but it doesn't send. I can either reply to an old message from that contact, or have to type in that contacts number. The message then sends, but if I then save the number to the contact and try and send the messa