|
Cast the returned object to a collection, and you have the Count property available. The issue here though is that the Session should explicitly return a Collection if that is what is being returned. It shouldn't return an object and then rely on you to cast the object. Apart from anything else, this is going to result in unnecessary boxing/unboxing on this object.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Adnan Siddiqi wrote: why can't I use argument as OPTIONAL in c#? it drives me crazy. why is it not overridable in c#?
Because C# doesn't support optional parameters.
Cheers,
विक्रम
Be yourself, no matter what they say.
- Sting, Englishman in New York.
|
|
|
|
|
Hi there,
Is it possible to zip Files using C#?
eg,
I populate my listbox with files from my c drive using file uploader. The I want to take all those files amd Zip them into one Zip file then save them.
How can I do that?
|
|
|
|
|
This[^] article might help you with this. Alternatively, take a look at the SharpZipLib project.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Other than setting the PieSize propertoy to crMaximumPieSize , any idea how to make them bigger??
Crystal Report sucks isnt it??
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I have IBM printer, In the printer prop' I Have OVERLAYS.
this is table of files that I send To the flash Memory on the printer And I can choose
what file I whant to print.
How Can i change The Selection On the Printer controler???? BY CODE???
Can I Use Drivers of the Printer to see This Option???
|
|
|
|
|
Hey!
Does aynone know if it somehow is possible to get continous events when clicking (and not releasing) a button? Or if it is somehow possible to achieve this behavior in some other way?
The thing is that I want to use regular buttons for scrolling and if the user wants to scroll much he could just click and hold the button instead of clicking many times.
|
|
|
|
|
The only thing that springs to mind is to start a timer on the button down event, and on each interval, check to see if the mouse button is still down / still over the button, and if so, fire an event. If the mouse button is up / not over the button, stop the timer.
It's 0800hrs here, my brain doesn't get into gear until about 1000hrs, so there might be a much better way.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
Malcolm Smart wrote: It's 0800hrs here, my brain doesn't get into gear until about 1000hrs, so there might be a much better way.
For a starter, I think you don't need to check state of button, but simply stop the timer on mouse up event of the button. Other then that, your idea looks ok to me.
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
if you don't check button state, if user moves his mouse with mousebutton clicked the program will still behave like the button would be clicked.
Pawel
|
|
|
|
|
I stand corrected, MouseUp OR MouseLeave.
I still think it's better to use available events then setting up timer and checking manualy. Then again, it's quite possible that I am missing something, since I've been doing exclusively web dev lately.
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Malcolm Smart wrote: It's 0800hrs here, my brain doesn't get into gear until about 1000hrs, so there might be a much better way.
It's 1000 here, and I can't think of a much better way either.
Unless I take longer to get my brain into gear. In fact, I browse these forums every morning to do just that - start thinking in developer mode and not human mode anymore.
I do not believe they are right who say that the defects of famous men should be ignored. I think it is better that we should know them. Then, though we are conscious of having faults as glaring as theirs, we can believe that that is no hindrance to our achieving also something of their virtues. - W. Somerset Maugham
My New Blog
|
|
|
|
|
Might be the reason is not your code xml file is not formated correctly
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
princymg wrote: Previously i didnt check the xml file
Unbelievable.;)
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
:(sigh:Hi Everyone,
Okay in the past two weeks I have learnt so much and I'm starting to work things out on my own. However even this one is tricky for me.
I am trying to automatically check checkedlistboxes based on data in the database.
I know I have to compare the dataset tableadapter to items in the ckedlistbox and then tick them if they match the ID. But how? I have created a join table aswell with EmpID and TechSkillsID so that people can tick multiple skills and they will be saved in there. Even though it isn't working yet. and yes the foreign keys are set up correctly. My code doesn't tick anything.
This is my code.
[code]
sql = "Select t.ProgLanguagesDatabase,e.EmployeeID,e.TechnicalSkillsID from TechnicalSkills t, employees e where t.TechnicalSkillsID = e.TechnicalSkillsID and e.EmployeeID = '" + FirstnameText.Text.ToString() + "'";
for (int i = 0; i < techSkillsCheckListBox2.Items.Count; i++)
{
for (int j = 0; j < this.dataSet1.TechnicalSkills.Count;j++)
{
if (i == j)
{
techSkillsCheckListBox2.SetItemChecked(i, true);
}
}
Thank you so much
Sianny (aka Sharny)
|
|
|
|
|
falles01 wrote: if (i == j)
I think your logic is wrong. All you are doing is comparing two numbers - the index of the item in the collection. Imagine techSkillsCheckListBox2.Items has 4 items and this.dataSet1.TechnicalSkills has 5 items. Your loop will look like
<br />
0 = 0 : true<br />
0 = 1 : false<br />
0 = 2 : false<br />
0 = 3 : false<br />
0 = 4 : false<br />
<br />
1 = 0 : false<br />
1 = 1 : true<br />
1 = 2 : false<br />
1 = 3 : false<br />
1 = 4 : false<br />
<br />
<br />
2 = 0 : false<br />
2 = 1 : false<br />
2 = 2 : true<br />
2 = 3 : false<br />
2 = 4 : false<br />
<br />
and so on , which is not what you want. You need to iterate through the dateset, retrieve the identifier of the skill, which should match an identifier on the check box, and then set the check box.
Step through with a debugger and you will see what's happening.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
Thanks. so I've heard. Just ignore i==j.I've tried everything and I know what the debugger is showing me but I would love to know exactly how to iterate through the dataset and compare the items in teh table to the items in my checkedlistbox. If the items are matching based on the techskillsID then I have to have them ticked. I have retrieved the ID by using
sql = "Select t.ProgLanguagesDatabase,e.EmployeeID,e.TechnicalSkillsID from TechnicalSkills t, employees e where t.TechnicalSkillsID = e.TechnicalSkillsID and e.EmployeeID = '" + FirstnameText.Text.ToString() + "'";
Can you suggest how I can create the if statement. I know we are supposed to be taught the logic and we find the answer ourselves, but I think I understand the logic but can't find the answer anywhere.Its the fact that I have a checkedlistbox, and a sql database and table adapters. its hard to find the exact answer when you have so many topics involved.
Thanks. Much appreciated.
|
|
|
|
|
I am assuming (hoping) that you create your CheckBoxList dynamically, and read the possible options from the db. When you do, you add the checks as ListItems. Something like
<br />
while (myreader.Read())<br />
{<br />
ListItem myCheckBoxItem = new ListItem( myreader["DESCRIPTION"].ToString() , myreader["ID"].ToString() );<br />
myCheckBoxList.Items.Add( myCheckBoxItem );<br />
}<br />
To select the relevant ones, read all the skills for a user from the database
<br />
sqlstring = "select skillID from userSkills where userID = 'myuser'";<br />
<br />
DataRow[] rows = dt.Select();<br />
foreach(DataRow row in rows)<br />
{<br />
string techID = row["skillID"].ToString();<br />
myCheckBoxList.Items.FindByValue( techID ).Selected = true;<br />
}<br />
And that's it. Please excuse typos etc as I can't get to a dev box to test this.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
Thankyou. that was an excellent answer. I am trying it, how ever...will that work with a winform not a webform? In order to use Listitem I had to add the web reference system.web.ui.webcontrols and that causes 1137 errors.
Hmmmmmm Is there someway of reading the dataset with out listitems?
Thank you
Sianny. (Aka Sharny)
|
|
|
|
|
I am not reading the dataset with ListItems. I am reading the dataset with reader.Read() and then populating the checkboxlist with ListItems.
How did you create your checkboxlist? have you hardcoded all the entries in Visual Studio or do you create it dynamically?
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
I tried to copy your code but it won't let me use listitems at all because it belongs to webforms. I have used tableadapters and have used Technicalskills list to bind as below. Sorry I'm a little confused.
private void TechnicalSkillsList()<br />
{<br />
<br />
DataSet1TableAdapters.TechnicalSkillsTableAdapter technicalskillsTableAdapter = new ResourceSearchTool.DataSet1TableAdapters.TechnicalSkillsTableAdapter();<br />
<br />
DataSet1.TechnicalSkillsDataTable techSkillsDT = technicalskillsTableAdapter.GetData();<br />
<br />
foreach (DataSet1.TechnicalSkillsRow techSkillsRow in techSkillsDT.Rows)<br />
this.techSkillsCheckListBox2.Items.Add(techSkillsRow.ProgLanguagesDatabase);<br />
<br />
}<br />
|
|
|
|
|
I have worked out on my own how to save multiple skills. so now its down to automatically populating the checkedlistbox with the skills.
which still brings me back to my precious forum post,,,but I'm still working on it and i'm giving you a 5 for being such a good response anyway.
|
|
|
|
|
Okay I was wrong. I didn't work it out. I'm still trying to save multiple skills and I thought it was saving them but it was actually saving the number of the index instead of the ID. Here is what I'm using. I still need the answer of how to get the id of the ticked items and then store it.
<br />
string sql = "SELECT t.TechnicalSkillsID from TechnicalSkills where TechnicalSkillsID = '" + techSkillsCheckListBox2.CheckedItems.ToString() + "'";<br />
if (techSkillsCheckListBox2.CheckedItems.Count != 0)<br />
{<br />
<br />
<br />
<br />
for (int x = 0; x <= techSkillsCheckListBox2.CheckedItems.Count -1; x++)<br />
foreach (int i in techSkillsCheckListBox2.CheckedIndices)<br />
{<br />
<br />
sql = "Insert into EmpSkills(EmployeeID,TechnicalSkillsID) values ('" + this.EmployeeID + "','" + techSkillsCheckListBox2.CheckedIndices[x].ToString() + "')";<br />
<br />
SqlCommand adoCmd = new SqlCommand(sql, adoConn);<br />
adoCmd.ExecuteNonQuery();<br />
<br />
<br />
<br />
<br />
<br />
Thank you so much ...this is killing me! I thought I had it.
Sianny aka Sharny
|
|
|
|
|
how to connect xml file to form in windows applications and even to connect two forms in windows applications
Ramya
|
|
|
|
|
Don't crosspost in Multiple Forums.
SSK.
|
|
|
|