|
Yes, good point. I just wonder if those multiple return statements are bad. Otherwise I defenitely go with version 1.
Vitaliy
|
|
|
|
|
Vitaliy Tsvayer wrote: if those multiple return statements are bad
This is a controversial topic and you can find many comments on this when googling for "multiple returns" e.g. this one[^] by Bruce Eckel.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I would go with version 1...
You can actually see when it returns null, in version 2 you really have to read all the code to know when it returns null...
Don't you also love the code?
|
|
|
|
|
Yes, Stefan in above reply also pointed that out.
OK, I go with version 1.
I LOVE THE CODE!
Vitaliy
|
|
|
|
|
Hello,
I have XML file, I can read and write data on it but there is a problem when i add data cause it overwrites the previuos inserted ones.
I need a code of insterting new data over the existing ones without updating i need to insert new values without the change on the previuos ones.
Thanks alot
Hamody
|
|
|
|
|
You can not add values to an XML file. Load the XML file to an XmlDocument object, add the items to the document, and save the document back to the file.
---
b { font-weight: normal; }
|
|
|
|
|
I am trying to derive bytes from a pass phrase. The latest MSDN doc
indicated that the PasswordDerivedBytes.GetBytes method is obsolete. This
leads me to the CryptDeriveKey method. I can get it to work just fine with the following:
algName = "TripleDES"
algHashName = "SHA1"
keySize=192
rbgIV. Length =8
[this produces byte[] length = 24 {192 bits}]
Now. I want to create a 256 bit byte[] for use with Rijndael.
Unfortunatelty, I do not know the "correct" parameter values. I thought:
algName = "RijndaelManaged"
algHashName = "SHA256"
keySize=256
rbgIV.Length = 16
I can not get it to work. I keep getting the following exception:
System.Security.Cryptography.CryptographicExceptio n was unhandled
Message="Object identifier (OID) is unknown."
Source="mscorlib"
Q1. What are the valid values for the algName ?
Q2. Can any hash be used for any algnName?
Thanks for you help.
|
|
|
|
|
Dear Sir,
I am working on a ASP.NET application, where i am using OLEdbConnection to connect to the Access 2003.
My objective of writing this code is to be able to change the existing password
Here :
T_EMP_PERSONAL is the table name
change_pwd.Text and pwd_txt.Text are the textboxes
Following is the code
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
try
{
string qry;
qry="Update T_EMP_PERSONAL set PASSWORD='"+change_pwd.Text+"' where PASSWORD='"+pwd_txt.Text+"'";
Label1.Text=qry;
con.Open();
OleDbCommand cmd=new OleDbCommand(qry,con);
cmd.ExecuteNonQuery();
Response.Write("Done");
con.Close();
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
OUTPUT
Syntax error in Update statement.
Where as, when i tried the same query in Sql server 2003 it executes succesfully
so could u pl help me out with this
thanks 4 ur kind support
arun
|
|
|
|
|
Arun Hegde wrote: when i tried the same query in Sql server 2003
How about running it in Access 2003? Perhaps Access would provide some information that would help determine the problem.
led mike
|
|
|
|
|
Hi,
Dear Respected Programmers.
kindly let me know that, How can I add Crystal Reports DesigntTime Designer into C# 2005 ?
Thank you in Advance
|
|
|
|
|
hi all...
is there any way by which i can get the print screen of a particular form and print it using c#.net...
Thanks in advance...
Rohit
|
|
|
|
|
|
Hi there,
VERY beginners question I'm sure, but how do I find out which drive letter my program was called from?
I'm writing an autorun program for a CD which just displays a simple form with my company logo and details about the CD and what it was anti-virus scanned with. When the user presses the "okay" button I'd like to automatically run explorer.exe with the right folder open for the CD.
Can someone give me a clue?
Thanks in advance!
Gary
|
|
|
|
|
Path.GetPathRoot(Application.StartupPath) should do the job.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Application.ExecutablePath
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I want to show the chinese and janpanese character on the the windows form .
When I type any chinese or janpanese character from the arialuni.ttf font ,I get the "?' rather than acutal character.
Any help in this regard would be highly appreciated.
Thanks
|
|
|
|
|
Hi,
Dear Respected Programmers.
Kindly help me. I am using C#. whenever I try to insert a datevalue into Access database, "Datevalue Example 05/08/2006" why it inserts like this ==> "08/05/2006"
Please send me the solutions
Thank you in advance
|
|
|
|
|
Because the database interprets "05/08/2006" as the 8th of may rather than the 5th of august (or vice versa).
Use a parameterized query, then you don't have to try to match the date format with the format that the database is using.
---
b { font-weight: normal; }
|
|
|
|
|
Iam using a third party dll to connect to HP9000 database.
Iam using this in c#.net 2.0 windows forms.
It was working fine for few days but now when iam trying to connect to database
its working fine in .net 1.1 but raising the following exception in 2.0.
attempted to read or write protected memory. This is often an indication that other
memory is corrupt.
What can be the reason????????????
|
|
|
|
|
.Net 2.0 is more secure ragarding memory access violations. I assume your 3rd party component has some errors which results in accessing memory adresses it is not allowed to access.
|
|
|
|
|
OK - first of all, I am fairly certain that this is possible, but while I know .Net, I do not know C#!
I have an out-of-proc COM server that optionally accepts a "callback interface" to allow a client to receive events. This is not the same as a connection point (so-called "COM Events").
Basically, the client implements the interface and passes its pointer to the method, and the server calls methods on this interface to notify the client of something. As such, clients are both COM clients and COM servers, and can be out-of-proc (another executable) or in-proc (a middleware COM component).
Now, I am pretty sure that C# can implement COM interfaces, and that it should be able to implement one that can be used in such a way. I just want to make sure, so I can state such in my server's documentation.
So - can this kind of callback interface be utilized in C#? What are the restrictions, of any? Can the interface be coded to support calls being made back on it on different threads, perhaps simultaneously?
Adva[Thanks] nce!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I am using c# for devloping an asp.net website. The problem is that the Sqldataadapter is disabled in toolbox. I can creat it in coding but just wanted to know if I need to use SqlDataadapter from toolbox what can I do so that it becomes accesable like in windows applications???
|
|
|
|
|
Hi all,
Context:
Everyone, who is using or has used VisualStudio.Net for develoment purposes Must have seen the Properties Window that appears when you select an Object on the Form, e.g.: Button, ListBox, ComboBox, etc. The "Properties Window" shows the properties of the object that has the focus.
The "Properties Window" contains a Listbox, which has always two columns. Column1 has static values and Column2 has dynamic values. The Column2 has text boxes, ComboBoxes, Browse Buttons, etc.
Need:
I would like to have a Similar Window, that would contain a listBox, whose Column2 will contain ComboBoxes. As many ComboBoxes as there will be rows in the ListBox.
Reason:
Actually, I am mapping tables and fields of one database(lets say DB1) to tables and feilds of another database(DB2).
DB1 has static values, DB2 has runtime values, and the database could be anything and could contain any number of fields. So, I was thinking if can have somthing similar to this(Properties Window) than I may be able to load the fields on DB1 in Column1 and provide a ComboBox in Column2. Clearly, the ComboBox in Column2 will hold the fields from DB2.
Any ideas, workarounds, links, etc... will be highly appreciated.
Thanks,
ps: http://www.codeguru.com/forum/showthread.php?p=1443783#post1443783
At the above link, there is an snapshot of what I want.
|
|
|
|
|
I think the property window is a datagrid, not listview.
In datagrid you can add combobox to each cell.
Just find how to do it in CodeProject.
|
|
|
|
|
Hi all,
I have an application which has a help file stored on the server.
Every time if ther user clicks Help button on the application i have to download the helpfile from server and have to show it to user.
if the user click Help again, I have to show the opened help without downloading from server to the user. if the user closes the file and clicks Help, then i have to download the help file from server
I have tried this solution
i will download the help(same file name). if it throws exception "Process can't be accessed", then i assumes that help is already opened so i will show that to the user. if the user closes file alone not process(eg. Word file, not the word applicaton) then i am getting the error "Process exited not information available"
how can we solve this. also is there any event from Process class so that i can get know the file is being closed?
Thanks and Regards,
Srini
-- modified at 7:13 Wednesday 16th August, 2006
|
|
|
|