|
In my opinion HashSet is the only reason to use 3.5, if it weren't for that I'd still 2.0 as well.
Are you using a Dictionary then? That's what I use in my Set[^] class.
|
|
|
|
|
Hi!
i know people have asked a lot about comboboxes but it's not really about how to get the value or index or whatever.Let me explain.it's users access management application with users, roles and rights:
i have a form editRight with 2 combobox cmbUsers to list users and cmbroles to list role of each users and 3 listboxes.let's pause here
on load event i fill users combobox with users
private void EditRight_Load(object sender, EventArgs e)<br />
{<br />
try<br />
{<br />
dt_users = UserManager.FindAll().Tables[0];<br />
cmbUsers.DataSource = dt_users.DefaultView;<br />
cmbUsers.DisplayMember = "user_name";<br />
cmbUsers.ValueMember = "user_id";<br />
<br />
CallFillRoleCombo((int)cmbUsers.SelectedValue);<br />
}<br />
catch (System.Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
}<br />
<br />
private void CallFillRoleCombo(int uid)<br />
{<br />
try<br />
{<br />
dt_roles = UserRoleManager.FindByUser(uid).Tables[0];<br />
<br />
cmbroles.DataSource = dt_roles.DefaultView;<br />
cmbroles.DisplayMember = dt_roles.Columns[2].ToString();<br />
cmbroles.ValueMember = dt_roles.Columns[1].ToString();<br />
}<br />
catch (System.Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
}<br />
<br />
}<br />
<br />
private void cmbUsers_SelectedValueChanged(object sender, EventArgs e)<br />
{<br />
CallFillRoleCombo((int)cmbUsers.SelectedValue);<br />
}<br />
when i run the code its throws exception:Object reference not set to an instance of an object.It seems that its calling the cmbUsers_SelectedValueChanged eventhandler when setting the display member of the cmbUsers combobox.
How to work around it?Thank you for reading this.
eager to learn
|
|
|
|
|
In the following code for loading data in user combobox
unsubscribe the event cmbUsers_SelectedValueChanged and after filling data
subscribe again
private void EditRight_Load(object sender, EventArgs e)
{
try
{
dt_users = UserManager.FindAll().Tables[0];
cmbUsers.DataSource = dt_users.DefaultView;
cmbUsers.DisplayMember = "user_name";
cmbUsers.ValueMember = "user_id";
CallFillRoleCombo((int)cmbUsers.SelectedValue);
}
}
hope this works for you!
|
|
|
|
|
got your problem
try this
private void cmbUsers_SelectedValueChanged(object sender, EventArgs e)
{
if (comboBox2.SelectedValue.GetType() == typeof(int))
CallFillRoleCombo((int)cmbUsers.SelectedValue);
}
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Thanks guys for replying this post.Really apreciated it.The method that worked for me is the one suggested by deep@Pune.Thanks
eager to learn
|
|
|
|
|
your most welcome!!
yersterday I forgot to include actual lines in the code to subscribe and unsubscribe the event!!
soru for that!!!!!
|
|
|
|
|
Hi ,
I need some sample code that populates the checkBoxlist(C# Windows Application) based on the table values present is a SQL server database table.?
Someone help in this regard..
Thanks in Advance,
Balaguru
|
|
|
|
|
|
Hi evryone
How can i make pdf from cristal report - in C# code (dont whant to see hem) ?
thank's
|
|
|
|
|
|
Hi all. I'm sure there are loads of articles and examples on the net for what I'm trying to do but I don't know what you would call it and consequently I'm not sure what to Google for.
I'm trying to simplify a file path to something that will fit into a certain number of characters. I think I can best explain by using an example.
Let's say I have a file path as follows:
C:\Documents and Settings\My Name\My Documents\Work Documents\Business Plan.doc
but I have only limited space to display this path. I'm not overly concerned that the user should be able to read the full path (although I can do that by providing a ToolTip or putting the full path in the StatusStrip or whatever) but I would like for the user to get a general impression of where the path points.
I am in other words looking for a result along the lines of:
C:\Docum...\...\Business Plan.doc
If you have any suggestions for articles or examples on the net that deal with this I'd be happy to hear. Also, the above sample result is what I quickly came up with but there may be more sensible ways of stripping down long paths to something shorter. Please let me know if you have any advice.
|
|
|
|
|
|
Only took me 10 minutes to knock this together - close enough?
<br />
private static string TruncatePath(string path, int chars)<br />
{<br />
if (path.Length < chars)<br />
return path;<br />
string drive = path.Substring(0, path.IndexOf('\\') + 1);<br />
string fileName = path.Substring(path.LastIndexOf('\\'));<br />
if ((fileName.Length + drive.Length) > chars)<br />
return drive + "..." + fileName.Substring((fileName.Length + drive.Length) -(chars + 3));<br />
else<br />
{<br />
return drive + path.Substring(drive.Length, chars - (drive.Length + fileName.Length)) + "..." + fileName;<br />
} <br />
}<br />
It definitely isn't definatley
|
|
|
|
|
Excellent stuff! That's exactly what I had been looking for. It wasn't really necessary to actually go and write the code but I appreciate the effort and your 10 minutes certainly saved me more than just 10 minutes.
I was curious actually whether there wasn't some class in the .NET framework that could achieve this. It turns out there is, TextRenderer.MeasureText and TextFormatFlags.PathEllipsis but that is when you render the text graphically. Your function is simple and elegant and does exactly what I wanted to do.
|
|
|
|
|
Hi.
In a report (rdl) I have a contract text that is about 3 A4 pages.
When I put the text in report, it only fills the odd pages. i.e. for 3 pages it produces 6 pages which pages 2,4,6 are blank.
What should I do to fix this problem?
Best wishes
|
|
|
|
|
What do I need to develop Outlook 2007 add-in using VSTO. I'm using Visual Studio 2005 Professional Edition.
What software/patches/libraries etc are required?
|
|
|
|
|
simple[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
|
Install .Net Framework 3.5 or higher
Ahmed Manzoor wrote: Lol, I didn't find any links on installation...
well well well, you have to read...no body gonna give you an exact thing always as well as you can change the searching text
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
|
Ahmed Manzoor wrote: So I think some thing special is not installed on my PC any clues?
I think I told you about installing .Net Framework 3.5 or higher. Do not avoid things else you're in black hole
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Ahmed Manzoor wrote: What software/patches/libraries etc are required?
It is mentioned in the article in your later posts,
Developing with VSTO requires a version of Visual Studio greater than Express Edition. The current beta of Visual Studio can be downloaded from http:
or at least Outlook 2003 SP1. Be aware that Outlook Express will not function as a replacement for Outlook.
You need VSTO[^] since you already have VS2005. Verify which version you need but, i guess it depends on which office version you have on your machine.
|
|
|
|
|
I installed .NET Framework 3.5, VSTO, I have Office 2007 so for that I installed VSTO SE.
But still it isn't working
|
|
|
|
|
The only thing i suspect is, the app was buil on a beta. and well i have no idea about VSTO
|
|
|
|
|