|
Hello everybody,
i added a column to my DataGridView with Buttons.
I created the EventHandler of CellEnter, ther'in i
like to delete this row.
The DataSource is an ArrayList of Classes which are displayed via his Members.
So if the user clicks the Delete-Button, the given record will be deleted in the database
and i refill the ArrayList with the new lines of the Database ( decreased by 1 row )
To refresh the DataGrid, i need to set the DataSource to null and re-set it to my ArrayList.
This works great in standard-functions, but not in this CellEnter-Event
I think i can't modify the DataSource of the grid because i'm into the handler of the grid.
Does anyone knows a solution?
In MFC i would make it via a PostMessage, that the code is executed after the EventHandler.
Big thanks
|
|
|
|
|
I'm trying to load an image from a file and then draw it. I found out the speed is quite unacceptable. This is the case especially when I want to render several images simultaneously using Image.FromFile() and Graphics.DrawImage() .
I wonder if there's any other way to improve the performance while rendering images?
|
|
|
|
|
That depends on how you're drawing the images, what the images are, how big they are, ... You haven't provided any useful details so it's pretty much impossible to tell you anything useful.
The quality of the answer you get is dictated by the quality of the question you ask.
|
|
|
|
|
Thank you.
What I wanna do is load all the pictures from a folder and display them all as thumbnails on a panel.
For example, I have a folder containing 50 pictures of size 3000 * 2000.
I used the Image.FromFile() to load all the pictures. And whenever a single picture was loaded, I used Graphics.DrawImage() to render it on the panel in no delay.
That's where the problem comes. The pictures came out at a incredibly low speed. Compared to Adobe Bridge, ACDSee or other softwares of that kind, I think although my algorithm may be inpropriate, there should be a better way to load and display images than using the .NET GDI+.
|
|
|
|
|
SeeBees wrote: For example, I have a folder containing 50 pictures of size 3000 * 2000.
No wonder... In order to generate the thumbnail, GDI is loads the entire file into memory then generates the thumbnail.
GDI+ is a generalized library, preferring compatibility over speed. If you want to improve performance, you'll need to find a third party graphics library that gives you the perfromance features you need. Figure out what your requirements are, then go shopping.
|
|
|
|
|
Well of course its going to be slow, you've got to load up all these images of your hard disk and put them in an image object, and the draw them all.
You could try loading up the images you need before they actually need to be drawn, that could speed things up. And im assuming (hoping) that you aren't loading up the images every time they need to be drawn.
And i think there is some function in one o' thems dll's to do a bitblit. Which may be faster. But that would require more code on your part.
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Thank you. You approach is surely better.
However, I've found that using the GDI+ provided by .NET, whatever I do, even loading and displaying a single large picture is time consuming.
And I don't know the o'thems as you called it. Could you please briefly explain it to me?
|
|
|
|
|
Sadly, i don't know what the function is called, what dll it is in, or how to use it. Sorry
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Error :Object reference not set to an instance of an object.
Here is my code.
SqlConnection conn = new SqlConnection("Data Source=servername;Database=dbCustom;Integrated Security=SSPI");
SqlCommand comm = new SqlCommand("GetProjects", conn);
SqlDataAdapter adapter = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
adapter.Fill(ds, "Project_ID");
ProjectidList.DataSource = ds; * it says error is on this line
ProjectidList.DataMember = ds.ToString();
|
|
|
|
|
Are there any values in the dataset. Your query might fail and in the dataset there are no tables...thus generating an error.
I will use Google before asking dumb questions
|
|
|
|
|
Im gonna guess that something went wrong when you tried to fill your dataset, or ProjectidList was not initialised properly.
Add an if statement to see if either of them are null or something.
My current favourite word is: PIE!
Good ol' pie, it's been a while.
|
|
|
|
|
Two reasons:
1) Are you missing a runat="server" for ProjectidList in the ASPX page?
2) Is ds null?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Before,
adapter.Fill(ds, "Project_ID");
, open your connection ,
conn.Open();
While you forgot this the dataset is null so as it says object reference not set to an instance of an object.
Regards.
.:: Something is Wrong ::.
|
|
|
|
|
Hy!
How can i disable the print button from a PDF file using C#, if there is a way to do it? I'm using Visual-Studio 2003, .NET Framework 1.1
Thanks!
|
|
|
|
|
|
Weeeelllll.............., i need to disable that print button automatically, so i suppose i need some kind of code to do this.
Thanks anyway!
|
|
|
|
|
Well, there's no way to do that. The security dictating what the client side can and cannot do with the PDF document, including printing it, is saved in the document itself. Your ASP.NET code, which runs entirely server-side only, cannot modify the interface of the client.
|
|
|
|
|
I see......!
Thanks for being so promptly!
|
|
|
|
|
Hello all,
I have a .NET 2.0 remoting service that listens on various URIs for requests, all well and good and it works perfectly.
However I would like to add functionality that displays a custom message should somebody telnet to the listening port.
Currently if somebody does this the following is displayed:
.NET☺☻☻♥☺♥☺☺hServer encountered an internal error. To get more info turn on cust
omErrors in the server's config file.
I would like to display something like this:
My Widget Application v1.0
blah blah blah something about usage blah blah something about auditing blah blah blah
What complicates this even further is the fact that the tcp channel is registered with a compression and encryption sink. Obviously a simple command line telnet connection is not going to send any data that is either compressed or encrypted, so I need this to bypass the sinks.
So does anybody know how to do this?
-- modified at 9:13 Friday 23rd November, 2007
|
|
|
|
|
1] how do i call an managed code from an unmanaged code .....
2] similarly is there any other way of embedding an unmanaged code in managed code without creating a DLL
Regards ,
Amol Jain
It Ain't Over ,Till It's Over
|
|
|
|
|
It depends on what you mean by unmanaged code. You could use the unsafe keyword to allow you to interact with pointers, or you can use P/Invoke to interact with pointer based code - see the site http://www.pinvoke.net/[^] for examples.
|
|
|
|
|
I have been trying to work out a synchronization mechnaism in C# using syncroot property of collections. I used a StringCollection class as an example to see what will happen in my code. Here is my Console application code:
namespace synctest
{
class Program
{
static StringCollection mycol = new StringCollection();
static void Main(string[] args)
{
for (int i = 0; i < 1000; i++)
{
mycol.Add(i.ToString());
}
Thread t1 = new Thread(Disp);
Thread t2 = new Thread(Manip);
t1.Start();
Thread.Sleep(10);
t2.Start();
Console.ReadLine();
}
static void Disp()
{
lock (mycol.SyncRoot)
{
for (int i = 0; i < 1000; i++)
{
Console.Write(mycol[i] + "-");
}
}
}
static void Manip()
{
for (int i = 0; i < 1000; i++)
{
mycol[i] = (i*2).ToString();
}
}
}
}
One thread displays the collection items while the other one tries to multiply the integer representation of each itme by 2. In my test, I expected the multiplier thread to wait for the first thread to finish its job, but i noticed that after number 20, all the displayed numbers were multiplied by 2. This means that the threads have overlapped and although I have used lock on the collection's syncroot property, the problem of concurrency still happens. Any clue?
|
|
|
|
|
hamidkhan wrote: and although I have used lock on the collection's syncroot property,
Doesn't seem so, looking at your code.
static void Manip()
{
for (int i = 0; i < 1000; i++)
{
mycol[i] = (i*2).ToString();
}
}
You should add a lock there. And please use the pre tags when posting source code.
Standards are great! Everybody should have one!
|
|
|
|
|
Hi,
I get the following error:
'System.Web.UI.WebControls.DropDownList' does not contain a definition for 'DatatValueField'
My code :
string sqlStmt = null;
sqlStmt = "GetProjest";//stored proc
SqlCommand cmd = new SqlCommand();
cmd.CommandText = sqlStmt;
cmd.CommandType = CommandType.StoredProcedure;
SqlDataReader sqlReader = cmd.ExecuteReader();
if(sqlReader.HasRows)
{
ProjectidList.DataSource = sqlReader;
ProjectidList.DataTextField = "Project_ID";
ProjectidList.DatatValueField = "Project_ID";
ProjectidList.DataBind();
}
|
|
|
|
|
This cannot be real....Read the error, it tells you exactly what's wrong. You misspelled the property. There is an extra "t".
What you wrote
ProjectidList.DatatValueField = "Project_ID";
What you should have written:
ProjectidList.DataValueField = "Project_ID";
I will use Google before asking dumb questions
|
|
|
|