|
Well first you don't put the code for this in the control (bad habit).
You expose a event on your control, the button click raises this event.
Then on the form that contains the control you catch this event and there you write the code to remove the control.
From memory (so you might want/need to adjust it a bit)
'in the event off the control
'customcontrol = the name of your control as it is named on the form
controls.remove(custumcontrol);
You can also pass along the name of the control in the event, then you can replace 'customcontrol' with that.
Hope this helps
[EDIT]Adjust the code to c# (forgot I wasn't in the vb.net forum [/EDIT]
|
|
|
|
|
mctramp168 wrote: in design environment
You really want to do this in design enviroment rather than pressing the ‘Delete’ buttono?
I Love KongFu~
|
|
|
|
|
thanks, I only want to know how to realize this function.
|
|
|
|
|
my application has the following procedure.
a database of products (20,000 rows) exists.
our client has 'import' feature where he imports an excel file.
this is implemented by deleting all products table rows, then doing the import - which is a long thing since we programmatically performing calculations on the data.
the obvious problem is if the 'import' action fails (IO stuff), they now have none/partial/curropt data in the products table.
We wish that if the 'import' operation fails, the original data remains.
this is ASP.NET application, written in C#, using SQL Server 2005 and using XSD which we created through the VS2005 design tools.
|
|
|
|
|
You can use transactions and roll back in case of errors.
Try googling[^] around
Regards,
Lev
|
|
|
|
|
1) Make a copy of the table that the stuff gets imported to. Ensure that this table is empty.
2) Import all your stuff to the secondary table
3) If there are no exceptions then delete everything in the original import-table, and copy all stuff from the secondary table to the import-table. If an exception did occur, the original import-table will still hold all data.
You could also use transactions to achieve a similar functionality. SQL Server caches all changes that way, in order to 'undo' them.
I don't know which of these options would serve you best. The transaction-approach would probably be faster to implement.
I are troll
|
|
|
|
|
Hi all
In windows forms we use "Application.StartupPath" to get the application folder does anyone know the equavalent for webpages,
I need to write a file using a filestream but i need the root folder for the web application on the server.
Regards
|
|
|
|
|
i think Server.MapPath is there.
rahul
|
|
|
|
|
Rahul Thank you very much, it worked fine.
Regards
|
|
|
|
|
[DllImport("kernel32.dll")]
private static extern bool ReadFile(
int hFile, // handle to file
byte[] lpBuffer, // data buffer
int nNumberOfBytesToRead, // number of bytes to read
ref int lpNumberOfBytesRead, // number of bytes read
IntPtr lpOverlapped // overlapped buffer
);
Anyone know what is this? How do i know what ReadFile do?
Thanks
|
|
|
|
|
|
Nope. Noone. Even documentation ignore it [^], [^] (and the function's name, 'ReadFile ', is so obscure!).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: the function's name, 'ReadFile', is so obscure
it can mean many things, such as lets go and read some data from a serial port...
|
|
|
|
|
You know, the serial port is a file.
cpallinux.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
what the differences here: number of bytes to read and number of bytes read?
|
|
|
|
|
I would think that one refers to the number of bytes read and the other refers to the number of bytes to read.
...are you kidding?
I read 14 threads today, now I only have 6 left to read....
do you see the difference?
|
|
|
|
|
Hi,
How do check, is user logged in Windows (xp/vista) with smartcard or password?
--
regards
Alkeemik
|
|
|
|
|
Dear All, I have developed different applications including client/server, distributed desktop and web based using c#.
for the first time i am entering a new stage called finger print using c#, i really dont know where to start and where to finish. i am looking for any reference for book, website and other resources.
Your cooperation is fully appreciated.
|
|
|
|
|
Well, Google is always a good start. I got about 115,000 hits for "fingerprint c#"
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
for sure, there is a lot of rerference which google refer too. I will appreciate to start from the big pciture, the correct path.
Not those paths which takes too long to go through that, and finally with no destination.
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
That is called research. It's an inevitable part of development
I are troll
|
|
|
|
|
Eddy Vluggen wrote: That is called research. It's an inevitable part of development
Sadly, a fact not recognised by many posters
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
People here are really stingy to reduce your research work. Maybe we need to get used to it.
I Love KongFu~
|
|
|
|
|
Please help me out.
I have an image and want to make it transparent. I didn't know how I will do this any idea will be helpful for me.
Thanks in advance.
|
|
|
|
|
First create a buffer image of the same size and resolution as the source image. Then draw the source image on the buffer, specifying the transparent color using the ImageAttributes.
Something like this:
Image image = Image.FromFile(@"c:\logo.png");
Bitmap buffer = new Bitmap(image.Width, image.Height);
buffer.SetResolution(image.HorizontalResolution,image.VerticalResolution);
Rectangle destRect = new Rectangle(0, 0, image.Width, image.Height);
ImageAttributes attributes = new ImageAttributes();
attributes.SetColorKey(Color.Red, Color.Red);
using (Graphics gr = Graphics.FromImage(buffer)) {
gr.DrawImage(image, destRect, 0, 0, image.Width,
image.Height, GraphicsUnit.Pixel, attributes);
}
buffer.Save(@"c:\logo2.png");
Regards,
Lev
|
|
|
|