|
Hi as i know there is not file lock problem...
i thought to do the first type....bcz over here this imageList is in side a listView as LargeImageList...so trying to do is
1- check whether listView.Item.Count == 0
if it is i just load images as useual...
2 else
i creat another image list and copy the first imagelist images in to that new imageList2 by using listView1.LargeImageList.Images copyTo by using ForEach loop...
after that i load new images in to NewImageList imageList2....so my new Images and previeous images will be in Same List.
then i load that image list into listView as LargeImageList....
is this way got anything wrong....??????
A S E L A
|
|
|
|
|
Hi,
I can't answer that, it is still a complete mistery what you want to get done.
For example:
1. how many ListViews are there?
2. how many images are there? (10, 100, 1000, or 10000)?
3. how large are those images (10*10, 30*30, 100*100, 300*300, 1000*1000)?
4. why do you think you should ever remove images from image lists?
and what is your app about?
And then: what exactly is going wrong?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 9:04 AM
|
|
|
|
|
hehee sorry i forgot to tellu all those....
ill brief u about what im tring to do...
i got two listViewBoxes(BOX A, BOX B)....both listView Boxes i got imagelists....
First user have to Load thier images in to this BOX A...once they load its shows like thumbnail type but actualy happening is doing small size drawing...
mean i load original picture into that (100, 80) size imageBox. i do this bcz later i need to save these images as what they was, in another directory...if i conver to thumbnail i cannot use it in bigger size again...This loading can be one time...or many time....also images can be one or many and many....
so that's y im facing a problem when i load images in second time my first images are no longer display but i can c the images in imagelist....with empty previous imagelist.. so i gussed it could be, no display.May be bcz of i creat another image list again in second time
i just count the user selected image by using openDialogBox.FileNames.Length;
here is my coding...
private void import(object sender, EventArgs e)
{
if(listView1.Items.Count == 0)
{
ImageList imageList = new ImageList();
imageList.ImageSize = new Size(100, 80);
imageList.ColorDepth = ColorDepth.Depth32Bit;
int i = 0;
string[] files = dlg.FileNames;
string[] pathes = new string[files.Length];
foreach (string file in files)
{
pathes[i] = file;
i++;
}
foreach (string path in pathes)
{
FileInfo fileInfo = new FileInfo(path);
String strDir = fileInfo.Name;
listView1.Items.Add(strDir);
imageList.Images.Add(Bitmap.FromFile(path));
}
for (int j = 0; j < pathes.Length; j++)
{
this.listView1.Items[j].ImageIndex = j;
}
this.listView1.View = View.LargeIcon;
this.listView1.LargeImageList = imageList;
}
}
A S E L A
|
|
|
|
|
I'm building some logic.
Inserting data from excel file of microsoft office.
So I made some logic like this
private DataSet ReadXLS(string FileName)
{
DataSet ds = new DataSet();
OleDbDataAdapter adapter;
string connectionString = @"provider=Microsoft.Jet.OLEDB.4.0;data source="
+ FileName + ";Extended Properties=\"Excel 8.0;Imex=1\"";
OleDbConnection conn = new OleDbConnection(connectionString);
try
{
adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", conn);
adapter.Fill(ds, strSheet);
}
catch
{
}
finally
{
if (conn.State == ConnectionState.Open) conn.Close(); }
return ds;
}
But this code has little problem.
The first line of excel sheet data is set to header column automatically.
In addition the header name automatically replaced to other characters
if it is number type.
I just want to get whole data from a excel sheet.
Help me.
|
|
|
|
|
I've been trying to find out how to find the preferred network connection (ex: WAN or LAN). There's a way to change the connection order in windows, but it doesn't seem like there are WMI classes that contain this connection order. Anyone know where to look/how to find the preferred connection?
|
|
|
|
|
Dns.GetHostAddresses("") appears to list the local IP addresses in the correct order with my current configuration, but its MSDN page[^] says nothing about the ordering, so it could be coincidence.
|
|
|
|
|
System.IO.IOException: Unable to read data from the transport connection: A system call that should never fail has failed. ---> System.Net.Sockets.SocketException: A system call that should never fail has failed
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
I'm not sure what to do with this. I saw this over 25 times in a log file today... I didn't see any hits for that string in Google either.
Hogan
|
|
|
|
|
I've seen it, but I just thought "what the heck? typically Microsoft". Unfortunately I don't know why it happens or what to do about it
|
|
|
|
|
snorkie wrote: I'm not sure what to do with this.
snorkie wrote: I didn't see any hits for that string in Google either.
Try this[^]
|
|
|
|
|
I'd have 9,000 posts on codeproject too if I spent all my time being a jackass. I even posted that I googled and didn't find anything. I should have posted that I didn't find anything helpful! I know what the exception is. My code caught and logged it... What I'm not sure about is what to do with it. The error code from the message, "A system call that should never fail has failed." is not exactly normal.
Hogan
|
|
|
|
|
snorkie wrote: I'd have 9,000 posts on codeproject too if I spent all my time being a jackass.
Your post didn't say anything about searching for the ERROR CODE, so f*** off you brain dead a**hole.
Oh, and have a nice day.
|
|
|
|
|
Sounds like a great idea. Its 5:00pm and I have nothing to do tonight!
Hogan
|
|
|
|
|
never encountered it before,
snorkie wrote: I'm not sure what to do with this.
may be you should log it to the "This log shall have no entries" log.
Yusuf
|
|
|
|
|
Hi snorkie,
Have a look here:
http://msdn.microsoft.com/en-us/library/ms740668(VS.85).aspx[^]
Reflector tells me that Socket.Receive ultimately calls on "ws2_32.dll" to get the job done and its recv function is returning a failure code of WSASYSCALLFAILURE (10107).
The description in the link above suggests a possible multi-threading issue or a corruption of the underlying network stack.
pb
|
|
|
|
|
Hi everybody hope you could solve my problems well let me explain it...
I have a c++ dll that uses MFC
I need to create an instance of a class inside that dll in a c# project
I need to end with another dll that can be added as reference in that c# projects
I have the code of the c++ dll so if necessary i can change it.
ok solutions? i have found many possible "solutions" but all that information confused me, well the possible solutions i found are:
Inside the c++ dll project add a managed class that just act as a proxy, the problem with this solutions begins when trying to compile it because causes many errors with "/clr" options...
Create a new managed c++ project that act as a proxy and use the dll, but i just couldnt use the dll inside the new project...
Create a rcw in c# with sentences like comimport... marhall... etc... but i just couldnt find a good tutorial for dummies. example i dont know where to get the GUID :S.
ok any solution that you can give me? an url to read? or what to search please help me...
Inside
|
|
|
|
|
EcK3kO wrote: I need to create an instance of a class inside that dll in a c# project
You can't do that.
One thing you can do is wrap that class in a managed class using C++/CLI. There are a massive number of introductory articles and information about CLI on the internet. There is even a series of beginner articles here on Code Project and of course a large amount of information on MSDN.
|
|
|
|
|
Hello,
I just finished one of my first programs, a program to show and hide windows by process. I'd like to go ahead and give it to my boss to put it in production, but the memory usage ranges from 12-15MB, and doesn't seem to make any sense.
A co-worker of mine has a similar piece of software (handles z-order of windows), which he programmed in delphi, and it only takes 4-5MB of RAM.
I attempted to call the garbage collector more frequently, but, as expected, this didn't have much of an effect (from what I've been reading, it does its job pretty efficiently on it's own).
Does anyone have any tips for memory optimization?
Thanks very much,
Matt
|
|
|
|
|
First, if you're looking in TaskManager to see the memory usage, it's lying to you. You're app isn't taking that much memory. A .NET app, like Java, runs in a kind of virtual machine. What you're seeing is what the .NET CLR has reserved for your application, even if the memory isn't being used. No, you can't do anything about it since all memory management is done automatically by the CLR.
If Windows needs the memory the CLR has reserved back, the CLR is more than happy to return whatever it can. The reseason the memory is reserved to start with is because when your code allocates memory for an object, it's much quickler to allocate it out of the managed heap the CLR maintains, than it is to go back to Windows, ask for a block of memory, add it to the managed heap, then allocate your object.
Calling the GarbageCollector doesn't do anything for you except screw up the internal optimization algorithm it uses. Unless you're an advanced developer with a definite need to do this and know precisely why you're doing it and the consequences of doing it, you show never force the GC to do an early collection.
Plus, 12 to 15MB of memory is nothing now-a-days, so what are you worried about??
|
|
|
|
|
Dave Kreskowiak wrote: Plus, 12 to 15MB of memory is nothing now-a-days, so what are you worried about??
from OP
OP wrote: A co-worker of mine has a similar piece of software (handles z-order of windows), which he programmed in delphi, and it only takes 4-5MB of RAM.
The Boss will make big fuss about .net
Yusuf
|
|
|
|
|
Yusuf wrote: The Boss will make big fuss about .net
Then the boss needs to read up on it and make form and educated opinion. The size of the runtime means nothing when it's productivity in writing code that's far more important. Ask him if he knows how memory management works in the .NET CLR. Does he know how it works in Delphi? Then compare the two.
Oh, and this reading is not just for the boss. It should be for you too, so you can explain it to him...
|
|
|
|
|
Hi,
I agree with Dave.
bbranded wrote: Does anyone have any tips for memory optimization?
The best optimization tip, assuming the functionality requirements warrant it: add lots of code and functionality, and rejoice when multiplying the source by 1000 makes the memory footprint grow by a much smaller factor.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 9:03 AM
|
|
|
|
|
Thanks for the info guys. I remember reading a blog post about it, but failed to be able to cite it to the senior dev.
I understand what you're laying Luc. Neato.
Thanks,
Matt
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
This isn't a solution as such - but an observation. When an .Net application is minimized, the reported RAM useage in task manager decreases dramtically. I found this with an app that I did that ran in the tray mostly. On launch I forced it to minimize before placing it in the tray and all the clients stopped moaning!
Also, make sure you've compiled it as 'Release', not debug if you're just testing/running the exe rather than an install, that can make a difference too.
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)
|
|
|
|
|