|
I have seen some funny stuff when closing MemoryStream , remove those .Close() for now. If that is the problem, what does work is placing it in a using block.
|
|
|
|
|
It doesn't help...
With the XmlSerializer it works...(but there I have a problem with the DateTime..I have to set there the XmlIgnoreattribute
Best regards
Hansjörg
|
|
|
|
|
as in subject. And put in into array string.
Training makes perfect....
|
|
|
|
|
Hello,
System.IO.Directory.GetFiles method helps you here.
I returns an array of Filennames.
All the best,
Martin
|
|
|
|
|
thanks Martin.
It really help me. I got all what i want from that.
Training makes perfect....
|
|
|
|
|
Glad I could help!
All the best,
Martin
|
|
|
|
|
Need to write a windows service which reads the mails stores on exchange server and should store into local database.
can any body describe with example,
please urgent
thanks in adavance....
Rahul
|
|
|
|
|
Hello.
Before I describe my dilemma, here's my code, roughly:
List<arraylist> allEntries = new List<arraylist>();
// fill allEntries with ArrayLists
// each ArrayList entered is at *least* of size 4
// allEntries.Count is 3
for (byte i = 0; i < 2; i++)
{
List<arraylist> goodEntries = allEntries.FindAll(delegate(ArrayList al) { return((byte)al[0] == i); });
// do stuff
} // for
The problem: inside the anonymous function, al[0] sometimes gives the values of al[1]. I need it to only compare the values of al[0], never al[1]. I have seen code where the delegate is an object from a user-created class (ex: (delegate(Cars c) { return(c.plateNum < 123); });).
What exactly am I doing wrong?
Any help or advice is appreciated!
|
|
|
|
|
Why are you using ArrayList at all ?
What is al ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Sometimes al[0] is returning the result of al[1], are you sure they are not equal in that situation?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
First, I apologize. My code was not correct, and I'm sure that added to the confusion.
Now, al is ArrayList al, and the reason I need al[0] is to see if two ArrayLists
contained in "allEntries" have the same value stored in index 0.
I have tried it when al[0] and al[1] contain the same values, and when they contain
different values. The result is the same, ie, in the anonymous function, al[0]
sometimes gives the values of al[1].
Here is my code again:
List<arraylist> allEntries = new List<arraylist>();
byte id0 = 0, id1 = 1;
byte sid1 = 16, sid2 = 88, sid3 = 100;
ArrayList entry1 = new ArrayList();
ArrayList entry2 = new ArrayList();
ArrayList entry3 = new ArrayList();
entry1.Add(id0);
entry1.Add(sid1);
entry1.Add("John");
entry1.Add("Doe");
entry2.Add(id1);
entry2.Add(sid2);
entry2.Add("Jane");
entry2.Add("Doe");
entry3.Add(id0); // notice index 0 of entry3 and entry1 contains id0
entry3.Add(sid3);
entry3.Add("Joe");
entry3.Add("Doe");
allEntries.Add(entry1);
allEntries.Add(entry2);
allEntries.Add(entry3);
for (byte i = 0; i < 2; i++)
{
List<arraylist> sameIdEntries = allEntries.FindAll(delegate(ArrayList al) { return((byte)al[0] == i); });
// do stuff
} // for
Any help is appreciated!
|
|
|
|
|
I have an ObjectDataSource bound to several columns including a read-only ID column. I am overriding the OnUpdating event and if I look at all the InputParameters everything is good but my ID column is null.
Is there anything special you have to do with a read-only column to get it to capture it and send it to my Update method?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi,
Can you send a bit of your code, I am not exaclty sure what you are trying to so.
Cheers
|
|
|
|
|
I got it. I was trying to get the value of a field on a gridview to get it passed to my ObjectDataSouce. I just found the selected row of my gridview grabbed the DataKey and did it that way.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Hi,
This should be easy but I can't work it out (nor follow the logic).
I have a comboBox that has its text bound to a field in a datatable. The items in the dropdown list are hard coded.
I have a Save button that has the following on_click event:
<br />
try<br />
{<br />
this.configBindingSource.EndEdit();<br />
this.configTableAdapter.Update(this.myWebDataSet.Config);<br />
this.myWebDataSet.AcceptChanges();<br />
MessageBox.Show("Changes recorded successfully.", "Information Only", MessageBoxButtons.OK, MessageBoxIcon.Information);<br />
setLogLevel();<br />
logger.Info("SaveButton_Saved");<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show("Unable to record the change.\nPlease try again.\nSee log file for details.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
logger.ErrorException("SaveButton_Failed", ex);<br />
}
Any changes in the comboBox are succesfully saved when the Save button is clicked.
There are no other databound controls on the form.
What I wish to do is eliminate the Save button and have the above events inside the Save click take place automatically. I thought I could just move the Save button events into the comboBox's SelectionChangedCommitted event but this doesn't save the changes back to the datatable/database. I even tried putting tsButtonSave.PerformClick() into the comboBox's event but that doesn't work either.
Can someone help me with the solution and perhaps explain to me where my logic is flawed.
Thanks.
Glen Harvy
|
|
|
|
|
Hello,
Glen Harvy wrote: move the Save button events into the comboBox's SelectionChangedCommitted event
Glen Harvy wrote: into the comboBox's event
Do this event's get fired?
Have you debuged it?
All the best,
Martin
|
|
|
|
|
"\" this is coming in my Xml output.I want eliminate this.
I am writing code in C# using StringBuilder class and XMLTextWriter.
Any Properties or Method's are there to eliminate this.
|
|
|
|
|
It's hard to work out what your problem is. You want to lose the slash ? Where is it ? Why do you need to lose it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I don't want the special character.I need everything except special character.But incase of attribute where this = sign is there these special chracter is coming.
|
|
|
|
|
Hi everybody.I have problems when calling dll.
Here is the Dll function definition(from the vander's document):
<br />
__int16 __stdcall MW_GetDBRecord(HANDLE icdev, __int16 fsid,<br />
__int16 rec_size, char *buf, int *rlen)<br />
Input parameters: <br />
icdev: device handle <br />
fsid: selected table NO. <br />
rec_size: a record size space.<br />
Output parameters :<br />
Buf: return entire record data (you need give buf enough space );<br />
Rlen: length of data .<br />
And here is my code:
<br />
[DllImport("mwhandset")]<br />
public static extern Int16 MW_GetDBRecord(IntPtr icdev,Int16 fsid,<br />
Int16 rec_size,ref string buff,ref int rlen);<br />
<br />
...<br />
<br />
private void button3_Click(object sender, System.EventArgs e)<br />
{<br />
...<br />
int rlen = 0;<br />
string buff;<br />
buff = " ";
MW_GetDBRecord(m_icdev,0,16,buff,ref rlen);<br />
}<br />
<br />
When calling MW_GetDBRecord it raise "System.NullReferenceException: Object not set to an instance".I'm sure the function has completed on the device,
because rlen=16(the record size) when the exception raised.So I think it is caused by type incompatibility,most likely the buff parameter.What type should I
use corresponding to "char *buf"? Or it is caused by any other reason?
Can anyone help me? Any idea will be appropriate.
|
|
|
|
|
This has to be
Xiaoming Qian wrote: [DllImport("mwhandset")]
public static extern Int16 MW_GetDBRecord(IntPtr icdev,Int16 fsid,
Int16 rec_size,ref string buff,ref int rlen);
Like this:
public static extern int MW_GetDBRecord(IntPtr icdev, int fsid,<br />
int rec_size, [Out] byte[] buf, int bufSize);<br />
And this has to be
Xiaoming Qian wrote: MW_GetDBRecord(m_icdev,0,16,buff,ref rlen);
this
int size = 256;
byte[] buf = new byte[size];
MW_GetDBRecord(m_icdev, 0, 16, buf, size);
I suggest you read these articles.[^]
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
There are two kinds of people, those who do the work and those who take the credit. Try to be in the first group; there is less competition there. - Indira Gandhi
|
|
|
|
|
Thank you, it works.
|
|
|
|
|
Hello everyone,
I use the following code to place an image "temp.jpeg" into an array and then write the array into a remote database.
int FileSize;<br />
byte[] ImageArray;<br />
FileStream fs;<br />
int iBytesRead;<br />
<br />
OpenFileName = "temp.jpeg";<br />
<br />
fs = new FileStream(OpenFileName, FileMode.Open, FileAccess.Read, FileShare.Read);<br />
FileSize = Convert.ToInt32(fs.Length);<br />
<br />
ImageArray = new byte[FileSize];<br />
iBytesRead = fs.Read(ImageArray, 0, FileSize);<br />
fs.Close();
I was wonder what I should do if the image is not a file such as "temp.jpeg" and it is the image displayed in a Button?
Can someone be kind enough to help me out on this one?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
You can save the image displayed in a Button to temporary file, and after that read from this file. Or you can save this image to stream, and then read it's data to array.
My english is not so good. Please, correct my errors.
Best regards, Alexey.
|
|
|
|
|
Does anyone know if it is at all possible to take an ImageList of large icons, resize them, and dump the smaller images into another ImageList? I am trying to do this dynamically since I will not have any smaller versions of the icons available to me.
|
|
|
|