|
Hi!
You're adding a reference to qwer to the List, so if you access this instance in the method you can modify its properties.
If you want a copy of qwer in the list, you should take a look at IClonable .
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thank you very much!
Your advise was greatly helpful!
|
|
|
|
|
plz send me a c# project that would accept the employee details and also be able to add,update,delete records.the back end in sql...i also need the connection establishment code.send the code to bharathi_n_r@yahoo.com
thankz in advance
|
|
|
|
|
I have your project ready to go. Contact me off the board for ways to pay the $10,000 consulting fee for writing this for you.
Or, you can do your own project ( is it your job, homework or a rentacoder job gone bad ? ), and then we'd be happy to help when you're stuck.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
No bady here will send you the code.
Try to do your self. If you have any problem or you need some idea then you are always welcome .
and as i see from your profile, you have joined here 2day. so welcome to Codeproject !!!
|
|
|
|
|
Thanks dude,
The problem i face with my project is that i am not able to do update..the registration form does not contain a data grid and i want the message to be displayed in the text boxes of the respective fields when i give the phone no(primary key)....and after i insert a record and try to insert another record and if i leave any field blank it is throwing me an exception"Failed to convert parameter value from a String to a Int32."provide me a solution for this man......
|
|
|
|
|
finished The project man.Thanks for making me work with the project,otherwie i would have sit idle and sought for help.The project is working wonderfull.
|
|
|
|
|
finished The project man.Thanks for making me work with the project,otherwie i would have sit idle and sought for help.The project is working wonderfull.
Thanks
|
|
|
|
|
finished The project man.Thanks for making me work with the project,otherwie i would have sit idle and sought for help.The project is working wonderfull.
Thanks.....
|
|
|
|
|
finished The project man.Thanks for making me work with the project,otherwie i would have sit idle and sought for help.The project is working wonderfull...
Thanks.....
|
|
|
|
|
I am using a keyboard hook to stop most if not all the keys on the keyboard but i am getting this message:
CallbackOnCollectedDelegate was detected
Message: A callback was made on a garbage collected delegate of type 'Client!KeyboardHook+HookHandlerDelegate::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.
any ideas how to solve it?
Luis E Tineo S
|
|
|
|
|
Error messages are so informative these days, that it almost gets too easy.
You have the solution handed to you in the error message already:
"When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called."
You have thrown away your reference to the delegate. Don't do that.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
I'm porting my application from Window Forms to WPF, and as soon as i managed to get the first things working i run into a Random problem. I get series of several identical results in a row in WPF(the code is the same from Window Forms(where it works), i only needed to modify stuff related to getting the resource path and setting the image control). I can't see why this is happening it's totally unrelated to the code apparently. The way it's set now it can be seen when running the app and seeing identical sets of stars along the columns(it's filled that way).
Get the project here:
http://files.filefront.com/WPFMyMoOrar/;9061030;/fileinfo.html
edit:solved: it was reseeding so fast that it was getting the same time seed(so i moved the initialization of the random object to class scope), interesting that this problem didn't exist in Window Forms.
-- modified at 3:21 Saturday 17th November, 2007
|
|
|
|
|
-Hi All,
-I need to callculate an age, Which is entered in a text box.
"This thing I need to do without postback the page."
-This thng I can make with postback the page but I need it done on the spot when entered a date to a perticular text box and the next moment the Age should be calculated and entered in the another text box.
-My Date Formate is - DD/MM/YYYY
-I need only age to be calculated and displyaed in a textbox
-So something like javascript or anythig that can do so....
Please help.
-Thnks
Believe Yourself :->
|
|
|
|
|
some script on client side
SkyWalker
|
|
|
|
|
Yeah, Mircea
Exaclty Something Like That....
Can u give it?
Believe Yourself :->
|
|
|
|
|
Well, maybe if you ask in the web development forum. You are aware that C# hasn't yet made it into the client side arena?
Calling all South African developers! Your participation in this local dev community will be mutually beneficial, to you and us.
|
|
|
|
|
The other answer you got was obviously from a rocket scientist...
Why ask for javascript in the C# forum ? You want the web dev or ASP.NET forum ( although your question is not ASP.NET related as such )
http://www.google.com.au/search?sourceid=navclient&ie=UTF-8&rlz=1T4ADBS_enAU225AU226&q=javascript+calculate+age[^]
Quite a few scripts in there that will solve your problem
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
How to read contents of a file(.txt) and display it in a textbox in C# windows form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace TEST
{
public partial class Form1 : Form
{
//string connection;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog objDialog = new OpenFileDialog();
objDialog.Title = "Open .cs File";
objDialog.Filter = "C Sharp Files (*.cs)|*.cs|Text Files (*.txt)|*.txt";
objDialog.InitialDirectory = @"D:\back up d triassic\users\k\Training\ConsoleApplication1";
if (objDialog.ShowDialog() == DialogResult.OK)
{
MessageBox.Show(objDialog.FileName.ToString());
}
listBox1.Items.Add(@"D:\back up d triassic\users\k\Training\ConsoleApplication1");
read();
Open();
}
public static void Open()
{
FileStream file = new FileStream(@"D:\back up d triassic\users\k\Training\ConsoleApplication1\ConsoleApplication1\Program.cs", FileMode.Open, FileAccess.Read);
// Create a new stream to read from a file
StreamReader sr = new StreamReader(file);
// Read contents of file into a string
string s = sr.ReadToEnd();
// Close StreamReader
sr.Close();
}
public static void read()
{
FileStream file = new FileStream(@"D:\back up d triassic\users\k\Training\ConsoleApplication1\ConsoleApplication1\Program.cs", FileMode.Open, FileAccess.Read);
// Create a new stream to read from a file
StreamReader sr = new StreamReader(file);
// Read contents of file into a string
string s = sr.ReadToEnd();
// Close StreamReader
sr.Close();
// Close file
file.Close();
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
Am stuck here.
Can anybody help me?
j
-- modified at 7:20 Saturday 17th November, 2007
|
|
|
|
|
|
|
ArrayList txtLines = new ArrayList();
// .. now read the text lines from the file with a file stream ....
values.Add (....);
// Bind the data to your listbox's datasource
yourLB.DataSource = values;
yourLB.DataBind();
SkyWalker
|
|
|
|
|
textbox1.Text = File.ReadAllText(objDialog.FileName);
new2pgrmg wrote: objDialog.FileName.ToString(
Why on EARTH would you call 'tostring' on a string ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Why am i getting this exception...
System.TypeInitializationException was unhandled
Message="The type initializer for 'Client.Form1' threw an exception."
Source="Client"
TypeName="Client.Form1"
StackTrace:
at Client.Form1..ctor()
at Client.Program.Main() in C:\Documents and Settings\Luis\Desktop\Server\Client\Client\Program.cs:line 21
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I added this code to it....
In a different class from the main form i have this:
// the try and catch were there already
try{....}// see the finally statement for more info
catch(....){....}// i just warned that all files in the given file will be deleted
//this is the newly added code
finally
{
//path points to a given folder,specify by the Administrator during runtime
//
foreach(string npath in Dfiles)
{
File.Delete(npath);
}
string[] files = Directory.GetFiles(@"C:\Backup", "*.lais");
foreach (string npath in files)
{
File.Copy(npath, path, true);
}
//this is the same i have in the try statement
Dfiles = Directory.GetFiles(@path,".lais");//just to make sure i have all the files now...
if(Dfiles>0){
foreach (string npath in Dfiles)
{
tempor = File.ReadAllBytes(Dfiles[i]);
ms = new MemoryStream(tempor, 0, tempor.Length);
crypto = new CryptoStream(ms, Algorythm.CreateDecryptor(), CryptoStreamMode.Read);
crypto.Read(tempor, 0, tempor.Length);
Images[i] = Image.FromStream(ms);
crypto.Close();
ms.Close();
}
}
}
plus... in the main form i added this:
private static Hook hook = new Hook();
//handle the keys
hook.KeyDown += new KeyEventHandler(hook_KeyDown);
hook.KeyPress += new KeyPressEventHandler(hook_KeyPress);
hook.KeyUp += new KeyEventHandler(hook_KeyUp);
//users are not allowed to do anything with the keyboard
void hook_KeyUp(object sender, KeyEventArgs e)
{
e.SuppressKeyPress = false;
}
void hook_KeyDown(object sender, KeyEventArgs e)
{
e.SuppressKeyPress = false;
}
void hook_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
The hook class is fine, the project class worked fine with it... after i added the finally statement was when the exception came...
What i want is: "If before the application starts a file in the given folder has been modified/altered, a file has been renamed/deleted/created with the same extension" and causes a decripting error i would like that file to be deleted and inform of the deletion without stopping the application. Durin' Runtime i know how to restore files that have been altered/modified but before runtime is quite hard to me!
Please help...
Luis E Tineo S
|
|
|
|
|
Hi!
The exception tells you that the type Client.Form1 could not be initialized correctly, i.e. either the static type initializer (if you have one) or the initialization of a static member threw an exception.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|