|
Hi all
I want to create a grid view control which inherits from grid view.
Now after i bind it datasource i want to hide some columns from gridview.
also i want to add some controls like checkbox ,dropdownlist.
How do i do this programatically.i dont want to do this using design view.
Please suggest which methods should i override and how do i create template here..
Waiting for answer
Tejesh
|
|
|
|
|
Try this:
DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn();
col. (fill the properties)
dataGridView1.Columns.Add(col);
|
|
|
|
|
I Google my problem but not succeed
can anybody guide me how can i write xml like following...
<parent xmlns="http://www.example.org">
<url>this is sample</url>
</parent>
How can i write the first line.
When I put it into
writer.WriteStartElement("Parent xmlns=\"http://www.example.org\"");
then it produce output like this
parent xmlns="http://www.example.org">
/parent xmlns="http://www.example.org">
/pre>
How can I write the first line.....
I don't know how I will do it.
|
|
|
|
|
|
|
Try replacing your <s with <s in the post - then we'll be able to see the html you're trying to achieve!
|
|
|
|
|
|
How does this relate to C# forum?
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
This is worse...
First you post a question...Vote some with 1 vote and delete your message...
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I have created a custom designer for a custom component:
internal class MultiColumnComboBoxDesigner : ControlDesigner
{
protected override void PostFilterProperties(
System.Collections.IDictionary properties)
{
properties.Remove("Font");
properties.Remove("Sorted");
base.PostFilterProperties(properties);
}
}
[Designer(typeof(MultiColumnComboBoxDesigner))]
public partial class MultiColumnComboBox : ComboBox
{
.....
}
I can add/remove properties using this method. However, how can I disable (greyed out) or enable properties please?
|
|
|
|
|
Everytime i change the Assemblyinformations in Visual Studio (under Project Settings) - the "Assemblyversion" for example - and make a new Release after i do that,
the values of the Properties (in Settings.settings) are deleted and have the default-values again (not the values, the user has assigned to the properties, when he using
the program).
Example: The Property "Database-Path" hast the default"C:\\Database.mdb"
The user assigned in the program the value "C:\\Documents and Properties\\test\\Database.mdb" to the application-property.
After i change the Assemblyversion of the program and make a new release of the program, the Property "Database-Path" has the
default-value (C:\\Database.mdb) again.
Is there any way to avoid this?
Thanks for helping!
|
|
|
|
|
Check out the GetPreviousVersion and Upgrade methods on your settings.
[Edit] Found a blog[^] on this
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)
|
|
|
|
|
Can you please explain me why it cannot be done? What is the rational behind it?
Thanks, Vered
|
|
|
|
|
Because the overloaded methods should be static?
|
|
|
|
|
Interfaces are only "contracts" that a class has some methods that can be called, regardless of the actual implementation of the class.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Right, but what about writing the signature of the overloading methods inside the interface and the implementation inside the object itself?
|
|
|
|
|
You can't declare abstract static methods inside an interface, and overloads are static methods.
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)
modified on Tuesday, January 27, 2009 6:54 AM
|
|
|
|
|
As everyone said, interfaces can't contain static methods. BTW, what are you trying to achieve?
|
|
|
|
|
I thought of creating a class that implements MyComparable and that instances of this class will be able to compare themselves. It's more for practicing, than a "real world" problem. I thought to declare the overloads in this interface (instead of use the CompareTo()).
I guess that what I'm really asking is how to compare objects without using IComparable, but with overloads.
Thanks,
Vered
|
|
|
|
|
You really should read the article[^] that I linked to previously, especially the section on Comparison Operators. All the information is in there.
Anyway, all you need to do is to implement overloads for < and > in your class. How you implement these is up to you, it very much depends on the data structure of your class and is not suitable for many classes. If you're implementing one of these operators, you MUST implement the second. The == and != operators are not necessarily required in your case, but if you choose to implement them you should override Equals and GetHashCode too.
Once you have < and > you can have your own CompareTo method that simply tests < and returns -1 if true, > and returns 1 if true, otherwise returns 0 (equal). I've given an example below. I've implemented IComparable too for completeness. The class just wraps a single Int32, obviously a real world example would be more complex.
using System;
public class MyClass : IComparable
{
#region Constructors
public MyClass(int value)
{
Value = value;
}
#endregion
#region Properties
public int Value
{
get;
set;
}
#endregion
#region Comparison Operator Overloads
public static bool operator <(MyClass instanceA, MyClass instanceB)
{
return (instanceA.Value < instanceB.Value);
}
public static bool operator >(MyClass instanceA, MyClass instanceB)
{
return (instanceA.Value > instanceB.Value);
}
#endregion
#region Compare Methods
public int CompareTo(MyClass other)
{
if (this < other)
return -1;
else if (this > other)
return 1;
else
return 0;
}
#endregion
#region IComparable Members
public int CompareTo(object obj)
{
if (obj is MyClass)
return this.CompareTo((MyClass)obj);
return 1;
}
#endregion
}
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)
modified on Tuesday, January 27, 2009 2:10 PM
|
|
|
|
|
'\0'
is the above command valid for calculating end of line in while loop...
if not wat should be used to EOF identification
the quieter u become more u hear
|
|
|
|
|
Hi,
as far as I know does the .NET-Framework abstracts the issue of string termination. If you read from a file for example, you can use the StreamReader.ReadLine(). This will read a whole line...
Regards
Sebastian
|
|
|
|
|
Are you looking for the "End of String", or "End of File"?
I are troll
|
|
|
|
|
end of string
the quieter u become more u hear
|
|
|
|
|
Use String.Length to locate the end of the string.
I are troll
|
|
|
|