|
Thanks all for the great help. I made a copy with all the different versions you briefed me with. I feel like this is a good start and I can make it with people like you. Thanks, really. ^^
|
|
|
|
|
Hi,
I have a function which returns a byte array. This method is being called in a loop. I need to build another byte array from these returned byte array.
For eg., in StringBuilder, we can keep appending string to it. Similar way, i need to append byte array to one main byte array.
How can this be achieved? Can anyone give me some solution here?
Thanks for your time.
|
|
|
|
|
byte[] byteArray1 = new byte[10];
byte[] byteArray2 = new byte[10];
List<byte> byteList = new List<byte>(byteArray1);
byteList.AddRange(byteArray2);
byte[] byteArrayAll = byteList.ToArray();
|
|
|
|
|
Thanks this worked fine
|
|
|
|
|
Create new byte array ,which length is the sum of the source arrays lengths and use System.Array.Copy to copy source data to the result array.
Life is a stage and we are all actors!
|
|
|
|
|
Once an array's size is declared, it cannot be changed so you can't append directly to the end.
If you know the end size you need then you can declare a new byte array, and use Buffer.BlockCopy to copy from other arrays into the new one specifying offsets where needed etc.
If the end size is unknown, I'd use a List<byte> and use the Add method to copy a byte or AddRange to copy other byte arrays into it, then call ToArray on the List<byte> at the end, and you will then have an array of the correct size.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I've been pondering on this a little more - these two methods may help. The first will append one or more individual items, the second one or more collections of items. These may not be the fatest, but they work.
public static T[] AddElements<T>(T[] currentArray, params T[] element)
{
T[] result = new T[currentArray.Length + element.Length];
Buffer.BlockCopy(currentArray, 0, result, 0, currentArray.Length);
for (int i = 0; i < element.Length; i++)
result[currentArray.Length + i] = element[i];
return result;
}
public static T[] AddElements<T>(T[] currentArray, params IEnumerable<T>[] elements)
{
List<T> resultList = new List<T>(currentArray);
foreach (IEnumerable<T> item in elements)
resultList.AddRange(item);
return resultList.ToArray();
} Some examples of useage:
byte[] currentArray = new byte[] { 0, 1, 2, 3, 4 };
byte elementA = 5;
byte elementB = 6;
byte elementC = 7;
currentArray = AddElements(currentArray, elementA);
currentArray = AddElements(currentArray, elementB, elementC);
byte[] elementsA = new byte[] { 8, 9, 10 };
byte[] elementsB = new byte[] { 11, 12, 13 };
List<byte> elementsC = new List<byte>() { 14, 15, 16 };
currentArray = AddElements(currentArray, elementsA);
currentArray = AddElements(currentArray, elementsB, elementsC);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
modified on Wednesday, August 26, 2009 9:00 AM
|
|
|
|
|
Thanks for your reply
|
|
|
|
|
Hello
I need to view pictures of a file now this file has many pictures i need a way to access the first picture then navigate to the last one, the problem is that the images are not numeric named so i cant increment number to access the other image please help.
|
|
|
|
|
What have you tried?
What are they named?
Do you have an index of some sort?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
i am trying DirectoryInfo class to get the files inside of it in file info array then i would iterate around them but am facing problems you cant know what the names of the picture bcz it is the client's disicion and there is no index or sort.
|
|
|
|
|
Then you will have to sort them by name, or create date. If the user doesn't catch on fairly quickly that sequential naming is a good idea if you want to find things, then spell it out to him when he compains...
DirectoryInfo di = new DirectoryInfo(@"c:\XXTemp");
FileInfo[] fil = di.GetFiles();
is the way to go.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
string[] picFiles = Directory.GetFiles(@"D:\PICS");
foreach (string picFile in picFiles)
{
pictureBox1.Image = Image.FromFile(picFile);
MessageBox.Show("Press OK for next picture...");
}
The pictures are unsorted. If you don't have any index, then sort "picFiles" to date and time.
|
|
|
|
|
Hello, there is no need to put Bold on entire message. Your question conflicts with the title.
Are you looking for next image in same folder or are you looking how to get next frame in Animated Image (GIF)?
EDIT: I didn't saw other post, because my Firefox has cached and i saw old page.
You don't need to know names of file. You can actualy parse the order. You coud by Character code.
Also if you chose by date time, it desn't mean it will be accurate. If it was taken by camera, and you change batteries, there is possible date information could reset and new files coud have wrong DateTime
|
|
|
|
|
well guys my testing on directoryInfo have seeded now i got the names of the picture now all i have to do is to change from one pic to onther in a web form. could any body suggest how to make that happen i was thinking of making a panel that changes its directory by either clicking forward or backward but how i could change a paned directory is ther something as a panel directory?? Or how about an update panel inside it there is a picture were i assign the picture every time i click.?
|
|
|
|
|
My program is able to detect faces in pictures when these faces are closer to the camera view
however it is not able to detect faces which are furthur away from the camera (small faces E.g. picture of a Football Team)
I m using Emgu for the reference
Can any1 give some advice on this matter
|
|
|
|
|
|
I databinded the gridview to datatable and displayed the fields.But the edit of gridview is not working..I am getting the following error.
'The GridView 'GridView2' fired event RowEditing which wasn't handled.'
Can anybody help me with this?
|
|
|
|
|
For this You have to register Gridview2_RowEditing Event in Code behind.
For example :
protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e)
{
//Write your editing Code here.
}
And for cancelling editing, You need to register Gridview2_RowCancellingEdit event.
For Example :
protected void GridView2_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
}.
You can visit MSDN for further information http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowediting.aspx[^]
Hope this will make sense to you.
Ankit Zaveri
|
|
|
|
|
Hi there , i am currently working on a project that is to share internet connection over a LAN, and i should write a custom NAT service! any one can help me where to start, offer me some references? any ebooks?... just thanks!
|
|
|
|
|
how to check weather all field of table has filled or not???
|
|
|
|
|
Is this to be done in the UI (validator and should be in the ASP forum) or in the code behind in which case you check the controls on the form or the datatable has null values.
|
|
|
|
|
We have an ASP.NET forum. The documentation on validators is also very clear, with lots of examples.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
darolia.manish wrote: all field of table
all fields of table means what?
Do you mean all field entries are filled or not? If so you can check each individual values that user feed in....
You can also place asp:RequiredFieldValidator for each controls
Or while executing the insert statement, loop through Parameters of command object and see of value of any parameter is null....
|
|
|
|
|
what do mean by table DataTable or an asp Table , or an Html table with tr and tds ??? please be more specific
|
|
|
|