|
CWIZO wrote:
I never heard of lazy initialization.
Then I suggest you look at ROTOR's codebase. Its full of it. EG
object foo = null;
public object Foo
{
get {return (foo == null) ? (foo = new object()) : foo;}
}
CWIZO wrote:
Properties cannot be inherited.: Property itself of corse it cannot be inheriated, but as a part of a class there is no probblem.
Now only a VB person would think that way!
top secret
|
|
|
|
|
I am not a VB person (never programmed there).
I never heard one would inheriate only the property in C#.
I am confused (maybe this would be becouse of my bad english?)
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
I found these as part of a quiz somewhere
|
|
|
|
|
1. none, i concur with u
2. again i agree with u, mustoverride is a VB6 keyword. I reckon this catches all of them wannabe VB.NET web monkeys
top secret
|
|
|
|
|
Hello friends, how are you?
My name is André, I´m brazilian, so my english is not so good, but I hope that you understand.
I need a Grid Control (or a ListView) that I can put 2 lines in the same cell....
If you could, please, see the next link, so this have a System Screen Picture that have the control I need. The control is these that contains tha products list: the product name in the first line, and the price and others informations in the second line (for each product).
http://www.acsn.com.br/Imagens/Frente%20de%20Caixa/Ampliadas/vendas%20ampliado.jpg
If you could help, I will be glad...
Thanks...
André
André
|
|
|
|
|
Search CodeProject for "ListView". You should find several examples for custom drawing with the ListView.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How can I find a reverse of a color?
Actually what I need is a color that will be readable on another background color.
For example if the background is white, the color would be black, if the background is dark green, the color would be white.
I tried using GetBrightness() of color to determine whether to use white or black, but that doesn't seem to work.
|
|
|
|
|
I recall reading a trick that mite work (not sure if it on works for 8 bit colors), but i forgot now (has to do with an XOR with -1 or just using the complement of an int, a color is just an int).
But be inventive, try this:
A2 = 256 - A1;
R2 = 255 - R1;
G2 = 255 - G1;
B2 = 255 - B1;
Mite work, let me know, im interested in what works
[edit] this works pretty good [edit]
top secret
|
|
|
|
|
When I make Active-x on C#. and It's host on IE.
ex.
<object id="a" width="700" height="700" classid="up3.dll#up3.Form1" iewastext="">
It work good. but I want , I control Host IE.
How I can get Host IE COOKIE, Control Location ? and etc.
IN C++, Get the Host IE Pointer, BUT C#, I don't know.
Tell Me how can i do?
thankyou.
http://flywithu.net
|
|
|
|
|
The control location you can get through various properties of the current AppDomain (see AppDomain.CurrentDomain ) or get the Assembly reference for your type and check various properties like Assembly.Location .
If you want to reference to the IWebBrowser2 interface for the host, you should make a property of that type (or just a simple object property) and pass that via script, which means you should expose the property through a defined class interface. I'm not aware of any simple means of querying for the host interface from a .NET control hosted in this manner (and this is a subject I did a lot of research on back in 1.0 beta days).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Does anyone know if it is possible to implement a Save File Dialog and a Open File Dialog in a DataGrid Control in C#?
Thanks
Alex
|
|
|
|
|
Anonymous wrote:
implement a Save File Dialog and a Open File Dialog in a DataGrid Control
Implement one IN a Datagrid Control? No, it's not...
But if you talking about exporting the data in the control to a file, you would have to either serialize the data out to a binary or XML file on the click of a button or menu item maybe, it's up to you, or you could write your own export/import code easily enough.
RageInTheMachine9532
|
|
|
|
|
Yeah,
I have this datagrid that gets populated with data from the database. One of the requirements is that the user should be allowed to specify a file name to save details of each record into. So, inorder to specify a filename, I wanted to open a file dialog to allow the user to choose a directory location. Actually the user will not do the "Save" operation there. It will happen later on. The user only needs to specify a location on the hard drive concatenated with a file name.
Let me know if that changes your perspective of the problem.
Thanks
Alex
|
|
|
|
|
Yeah it does. But you don't implement a SaveDialog in your DataGrid. It's done on your form, or anywhere it would make sense in your interface, but not inside another control. Then, maybe, the use can click on checkboxes to tag records to be saved, no? Then when everything is all set to export, you have to pick out the record details and write them to a file yourself. You'll have to supply the code for import and export. Possibly create another DataSet using the checkmarked record to fill the table, then serializing the data out to a file. It's entirely up to you what kind of file you want to use and how you want that data to look in it. That will determine how you write the file out.
RageInTheMachine9532
|
|
|
|
|
i posted before asking how to accomplish this and was replied to, but what they said didn't seem to work (else i was being more thick than usual! :p).
this is what i need to do:
in an MDI environment, have a variable in FormParent called MyVar. i need to set this within that form (a task i do understand!) and then in my child generated from FormChildTemplate check the variable and set it as something else, then to be able to use it again in FormParent.
anyone get the idea and can tell me?
thanks in advance,
surgeproof.
----------------------------------------------
looking for hosting? ithium is good.
|
|
|
|
|
Either pass a reference to the parent form in the constructor (or a property) of the parent form's Type, or cast the child's MdiParent to the actual form's Type and access the public or internal property or field. If you just try to access it from MdiParent , it won't work because that returns a Form , which doesn't declare your field or property. That's what you cast it, since your parent form is a derivative of Form .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
thanks. you couldn't explain that a little bit more please could you? do you mean when initialising my variable putting something like (FormParent) on the end? or would i try FormParent.MyVar beacuse this doesn't seem to work.
thanks.
-------------------------------------------------------
looking for hosting? ithium is good.
|
|
|
|
|
It's a simple matter of access. First, your field (not variable, which is a temporary variable declared in a method) or property (properties are recommended to use from other classes) must be either public or internal (for classes within a single assembly), or protected if using a derived class (which you probably wouldn't). Then you must make sure the child form can access that field or property either by casting MdiParent or passing a reference to your parent form (FormParent I'm assuming) to your child form. An example of the former is:
public class MyChildForm : Form
{
protected void ShowParentFormsProperty()
{
FormParent form = (FormParent)MdiParent;
if (form != null) MessageBox.Show(form.MyProperty);
}
} The latter way:
public class MyChildForm : Form
{
private FormParent parent;
public MyChildForm(FormParent parent)
{
this.parent = parent;
}
protected void ShowParentFormsProperty()
{
if (parent != null) MessageBox.Show(parent.MyProperty);
}
} In both examples, your FormParent may look like this:
public class FormParent : Form
{
public FormParent()
{
MyChildForm form = new MyChildForm(this);
AddOwnedForm(form);
}
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
thanks, i'll try that and say how i got on soon.
surgeproof
-------------------------------------------------------
looking for hosting?ithium is good.
|
|
|
|
|
Does anyone know how to convert a .NET bitmap to a DIB? I have tried to port code from C++ without success, so I would appreciate any help. Thanks alot
|
|
|
|
|
isn't a DIB just the method bitmaps use to store? and do you want to convert in realtime or just with an application? if it's the latter you might want to use something like PainShopPro or AdobePhotoShop etc. but if it's in realtime i'm not sure. wouldn't you use the System.Drawing.Imaging controls?
surgeproof.
-----------------------------------------------
looking for hosting?ithium is good.
|
|
|
|
|
Hi all!
I'm a bit new to C#. I am developing a Windows application. I've spent a few weeks designing this application. I want the windowsapplication to be the client in my server/client system. I want to connect the server to a database and bring back the data from the dB to the client. As I said, I'm new to C#, and not a very experienced programmer. Where and how do I start implementing this system?
Grateful for all the help I can get!
/Martin
|
|
|
|
|
The first thing to do is to read through the topics in the .NET Framework SDK[^] (also installed on your machine as part of the .NET Framework SDK and VS.NET). Specifically, take a look at Accessing Data with ADO.NET[^]. CodeProject also contains a wealth of information, but familiarize yourself with the basics of .NET development first (i.e., what an assembly is, what managed code is, how C# relations to the .NET Framework and managed code, etc.).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a class with a property which I want to bind to the selected value of a Listbox.
I use the databindings property of the listbox, and the binding work fine...when you select a different value from the listbox, it updates the objects property. The problem is that when you lose focus on the listbox, the selected Index gets reset to -1...Any thoughts??
Gregg R
|
|
|
|
|
Are you using ListBox or ListView?
For ListView the default property for HideSelection is true, so when it looses focus, it seems like the selection is gone. If you set that to false, the listview will show selection after focus is lost.
If it's ListBox, it shouldn't set the selected index to -1, unless you're doing it programmatically somewhere in your code.
|
|
|
|