|
class library is what you are asking...
|
|
|
|
|
The concepts and terminology has changed with .NET. We no longer have to fiddle with a DLL/EXE/COM Components etc. Read about the concept of ‘assembly’
If you are using MS Visual Studio .NET 2003, create a new project of type ‘Class Library’ Thats your DLL. In the project create you classes and methods. All these will be accessible to the consumer of the DLL. (The consumer has to ‘Add reference’ of the created DLL in his/her project to consume your classes)
|
|
|
|
|
Does anyone know how to [easily] obtain the color of a GroupBox caption when themes are active? (A .NET 2.0 specific solution is acceptable.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I wrote some code to show data from access using datagrid. However, when I try to update or delete data, it always report error that Dynamic SQL generation for the UpdateCommand or DeleteCommand is not supported against a SelectCommand that does not return any key column information. However, when i add data, it is fine.
private OleDbDataAdapter adapter;
private DataSet ds;
private DataTable table;
private DataForm form;
private TextBox[] txtBox;
private OleDbCommandBuilder builder ;
try
{
adapter = new OleDbDataAdapter("select * from CMA",
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=datainfo.mdb");
builder = new OleDbCommandBuilder(adapter);
ds = new DataSet();
adapter.Fill(ds);
dataGrid1.DataSource = ds;
table = ds.Tables[0];
dataGrid1.SetDataBinding(table, "");
this.dataGrid1.CaptionText = "Table: CMA";
}
catch(OleDbException ex)
{
MessageBox.Show(ex.Message);
}
private void OnDeleteData(Object sender, EventArgs e)
{
for(int i=0;i
|
|
|
|
|
The error says it all: it's unable to generate a SQL expression for UpdateCommand and DeleteCommand because your SelectCommand doesn't include key data. Running UPDATE and DELETE expressions requires either 1) your primary key, or 2) some other data that only you could determine to be unique. A primary key is always unique, so the SQL builder requires key data. Of course it isn't needed for InsertCommand because you're adding data; your key may be an identity column that is automatically filled so the SQL builder doesn't care.
There are two options: select your primary key column(s) for your SelectCommand , or don't use the SQL builder and define the commands yourself.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
|
I am spent all day that I am trying to rid the box look like ... on propertygrid from keep from activate editor collection. I tried to look internet and no luck. I tried to use
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.None;
}
but it wont trigger. please help me about this situation. please show me with example source if neccessary. ThankS!!
|
|
|
|
|
For what object? Is this on an object you define, or for another? It's impossible to answer this object without knowing what type of object your setting to PropertyGrid.SelectedObject and whether or not it's a type that you've defined.
If you've defined it, then you have total control over your properties (but not necessarly properties of your properties' property types). If not, there are still some things you can do depending on what type of object it is.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Heath Stewart wrote:
you have total control over your properties (but not necessarly properties of your properties' property types).
Ok, is it me or is that just funny if you try and say that 10 time really fast?
- Nick Parker My Blog | My Articles
|
|
|
|
|
He probably got the poor guy confused as hell.
|
|
|
|
|
propertyGridPart.SelectedObject = partInfo;
sorry about lacked of details that I explained my previous details. I just found the article that I am looking for http://www.codeproject.com/cs/miscctrl/customizingcollectiondata.asp?df=100&forumid=16073&fr=51#xx546899xx[^] , but it still dont solve my problem. you noticed on Fig. 5: Edit collection content that it has been red circle. I want that button gone or not appear that button at all. I tried everything to get rid that frigging button but no luck. I tried to use [Editor(typeof(MainDialog),typeof(UITypeEditorEditStyle))] and
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.None;//I cant get anything
//to trigger this part
}
I have no idea how can I fix this problem. just explain it how to stop that frigging buttn appear. Thanks in advance
|
|
|
|
|
The problem is that the Type of the property warrants an editor, so you need to attribute your property (which takes precedence over the attribute on the property Type) with an editor that doesn't do anything:
using System;
using System.Drawing;
using System.Drawing.Design;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.PropertyGrid propertyGrid1;
private System.Windows.Forms.RadioButton radioButton1;
private CustomRadioButton radioButton2;
private System.Windows.Forms.GroupBox groupBox1;
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new CustomRadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
this.propertyGrid1.CommandsVisibleIfAvailable = true;
this.propertyGrid1.LargeButtons = false;
this.propertyGrid1.LineColor = System.Drawing.SystemColors.ScrollBar;
this.propertyGrid1.Location = new System.Drawing.Point(8, 88);
this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.SelectedObject = this.radioButton1;
this.propertyGrid1.Size = new System.Drawing.Size(280, 264);
this.propertyGrid1.TabIndex = 0;
this.propertyGrid1.Text = "propertyGrid1";
this.propertyGrid1.ViewBackColor = System.Drawing.SystemColors.Window;
this.propertyGrid1.ViewForeColor = System.Drawing.SystemColors.WindowText;
this.radioButton1.Checked = true;
this.radioButton1.Location = new System.Drawing.Point(8, 16);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(160, 24);
this.radioButton1.TabIndex = 1;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "BackgroundImage ...";
this.radioButton1.CheckedChanged += new System.EventHandler(this.switchObject);
this.radioButton2.Location = new System.Drawing.Point(8, 40);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(160, 24);
this.radioButton2.TabIndex = 2;
this.radioButton2.Text = "No BackgroundImage ...";
this.radioButton2.CheckedChanged += new System.EventHandler(this.switchObject);
this.groupBox1.Controls.Add(this.radioButton1);
this.groupBox1.Controls.Add(this.radioButton2);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(280, 72);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(296, 365);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.propertyGrid1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "Form1";
this.Text = "Example";
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void switchObject(object sender, System.EventArgs e)
{
RadioButton radio = sender as RadioButton;
if (radio != null && radio.Checked) this.propertyGrid1.SelectedObject = radio;
}
}
class CustomRadioButton : RadioButton
{
[Editor(typeof(CustomRadioButtonImageEditor), typeof(UITypeEditor))]
public override Image BackgroundImage
{
get
{
return base.BackgroundImage;
}
set
{
base.BackgroundImage = value;
}
}
class CustomRadioButtonImageEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.None;
}
}
} Pay attention to the BackgroundImage property in the PropertyGrid when selecting the different options.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
yup. that is what I am looking for. Why didnt I thinking that before? everything works great until huge problem appears are using collection. I got a whole list working in the property grid with collection,PropertyDescriptor,CollectionBase, and ICustomTypeDescriptor, but guess what?? that ... button is back again. I tried to use
class CustomListPropertyEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.None;
}
}
and went crashed bec collection was suspended bec of UITypeEditorEditStyle.None; other words, they wont make a list. so my question is: how can I get working with whole list without appear that frigging ... button on that list(if yu dont know what it is,then look my previous question.)?
If you dont know how to solve this problem, dont worry bout it.
|
|
|
|
|
GoodQuestion wrote:
If you dont know how to solve this problem, dont worry bout it.
Apparently you haven't noticed who I work for. I'm also a former C# Most Valuable Professional for Microsoft. This problems not at all hard...
...except that I'm afraid I don't understand you (grammatically). What I told you works for any property Type and you don't need to implement ICustomTypeDescriptor to implement it.
Are you saying that you're trying to assign a collection object to PropertyGrid.SelectedObject and you're getting the [...] button? That certainly doesn't make any since your object is the collection, unless your objects that you're collecting contains list or collection properties.
Please try to do a better job of explaining your situation. Also keep in mind that if you got this to work for an IList implementation than it would work for an <cod>ICollection as well (IList inherits from ICollection ). The key is to remember that attributed properties takes precedence over attribute types, so the PropertyGrid will use the EditorAttribute on your property (if any) before using the EditorAttribute on the property's type. This is documented in the .NET Framework SDK.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Sorry bout poor explaining abut my situation bec I was really hurried that I have an appointment. Before I starting to ask you, I want to say thanks that you replied quickly and helpful to me. I have plenty time to explaining what is my situation. I am trying to rid .. or modal on property grid. I had success with using UITypeEditorEditStyle.None on other propertygrid but I cant get this one. I made picture(it is not pretty bec I cant copy Paint Microsoft on this message board) to show where is mistake and I put ***** and it will help you to find where are they. This is part of source codes with property grid. I know it is big one bec it is easier to show you then explain everything, you know.
(CMainViewDlg)
try
{
ArrayList OpnShapeList = m_ArrayList;
CPartInfo partInfo = new CPartInfo();
partInfo.Job = m_Part.JobName;
............
SurfaceInfo empsurf = new SurfaceInfo();
int nCount = 1;
foreach(ILogicalOperationShape pIOpnShape in OpnShapeList)
{
string[] strHeaderArray = null;
...
empsurf = new SurfaceInfo();
empsurf.Pattern = "Barber" + nCount;
empsurf.OpnShapeData = pIOpnShape.OpnShapeName;
.....
for(int i=0; i < strHeaderArray.Length; i++)
{
string strValue;
....
if(i == 3)
empsurf.InnerDia = strValue;
if(i == 4)
empsurf.Bolt_Dia = strValue;
if(i == 5)
empsurf.NumberofBolt = strValue;
}
partInfo.Surfaces.Add(empsurf);
nCount++;
}
propertyGridPart.SelectedObject = partInfo;
(partinfo)
public class CPartInfo : UITypeEditor
{
private string m_strJob = "";
.....
SurfaceCollection surfaces = new SurfaceCollection();
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.None;//it is not working
}
[CategoryAttribute("Part Data"), DescriptionAttribute("Job Name"),ReadOnly(true)]
public string Job
{
get
{
return m_strJob;
}
set
{
m_strJob = value;
}
}
...........
..........
[TypeConverter(typeof(SurfaceCollectionConverter)),CategoryAttribute("Barbers")]// make list from SurfaceCollection
public SurfaceCollection Surfaces
{
get
{
return surfaces;
}
set
{
surfaces = value;
}
}
(SurfaceCollection)
public class SurfaceCollection : CollectionBase, ICustomTypeDescriptor
{
#region COLLECTION
public void Add( SurfaceInfo emp )
{
this.List.Add( emp );
}
public void Remove( SurfaceInfo emp )
{
this.List.Remove( emp );
}
public SurfaceInfo this[ int index ]
{
get
{
return (SurfaceInfo)this.List[index];
}
}
........(all are ICUSTOMTYPEDESCRIPTOR)
public PropertyDescriptorCollection GetProperties()
{
PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
// Iterate the list of employees
for( int i=0; i
|
|
|
|
|
Implementing UITypeEditor won't do it like you are for the CPartInfo class. You can implement it, but you need to attribute CPartInfo using the EditorAttribute like in the example I gave you before:
[Editor(typeof(CParkInfo))]
public class CPartInfo : UITypeEditor
{
} Honestly, though, you should extend this with some other class than CPartInfo since that limits your ability to derive from anything else now (since managed languages like C# - among many other non-.NET languages - don't support multiple inheritance).
Also, you shouldn't prefix your classes with "C". Hungarian notation in .NET is dead. You should read Naming Guidelines[^] in the .NET Framework SDK. Using consistent naming conventions helps poductivity, something the .NET Framework aims to accomplish and, IMO, does a very good job.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello,
I want to formate my laptop, does anybody know how i can save my stored procedure and the sql database of a web project of mine??
thx
regards
patrick
|
|
|
|
|
Use a back up utility.
If it is just the database and nothing else you can go into Enterprise Manager, right-click the database, select All Tasks and then Backup Database...
Make sure you do a complete backup.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Hello,
thank you for your reply, but when i want to click ok in the backup db procedure to backup the database the following error occurs:
The volume on device 'C:\6.Semester\BackupShop' is not part of a multiple media set. BACKUP WITH FORMAT can be used to form a new set. BACKUP DATABASE is terminating abnormally.
Any ideas what went wrong??
thx
regards
|
|
|
|
|
Hello,
When i now want to open a Web Service in my VS.NET the following error occurs:
The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/ReservationClient'. 'HTTP/1.1 500 Server Error'.
Can anybody give me further help??
regards
patrck
|
|
|
|
|
pat270881 wrote:
Can anybody give me further help??
No further help can be given for something as unspecific as "Server Error". We need to know more information. If you can, browse to http://localhost/trace.axd. If it doesn't exist, turn on logging in /Web.config. If tracing isn't enabled and you're browsing to localhost, then the page handler for trace.axd should also tell you how to enable it.
Once that's done and you've reproduced the error, what exception are you getting? What does the exception text say?
Once you find all that out, post it to the ASP.NET forum. This forum is for C# questions not specific to ASP.NET since there's already a forum specific to ASP.NET.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
There were never display the Trace.axd when quoted it in the browser although i have trace enabled to true..???
in the event log of windows eventviewer the following warning occurs:
the server could not load the applicaiton '/LM/W3SVC'. 'Quoted Medadata could not be found.'
any ideas?
regards
patrick
|
|
|
|
|
ASP.NET forum
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
i'm creating a tool that requires constant detailed, fancy, colorful logging. The richTextBox provides pretty much most of what I need, but i find it unreliable. When text is being sent to the RTB constantly, attempting to color code each of the lines, it will miss some of them. and in some cases, when text becomes very large, it starts throwing exceptions when things like color coding are used.
so is richtextbox all i got when it comes to trying to do a lot of text logging, with different colors, fonts, etc?
i thought about replacing the rtb with a webbrowser control, and do everything in html, but then i thought how would i do this. i coudl have to recreate the entire page every time i made a change and refresh the browser, right? is there a way to just "add" text to an existing page through the webbrowser control?
thanks
|
|
|
|
|
Hi,
I am searching for the best regex mail pattern with C#.
Thank you,
Cem Louis
|
|
|
|