|
Dear All,
I am developing a DLL to allow other program to import as a reference (something like creating an API). As we know, when other program declares a reference to my DLL, and starts using it, after typing the object name followed by a dot ("."), a list of properties and methods available from the DLL will appear. What I want to ask is, is it possible for me to add Intellisense features to my DLL, providing a quick info to the properties and methods that I have in the DLL, to the clients of my DLL? I have heard that this can only be achieved if I develop the DLL using C#, not VB.NET, is that true?
Thanks alot for ur help
|
|
|
|
|
ysuwardy wrote:
I have heard that this can only be achieved if I develop the DLL using C#, not VB.NET, is that true?
No, that's not true.
There are two things that you have to do. First you have to add documentation to your code, then you have to make Visual Studio create an xml documentation file from the comments.
In C# you use /// to create xml comments, in VB you use '''. Just type it on the line before the method, and Visual Studio gives you the start automatically.
I have described how to make Visual Studio create the xml documentation file before, in some of these boards. Search for it.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks alot for the heads up
|
|
|
|
|
Hi Guffa,
I have written some documentation to my DLL, build it, seen the .xml counterpart of the DLL. But as I test it in another project, having imported the dll, copy the xml over to this project's bin folder (is this necessary?), I still only see the method signature from my DLL as the quick info, the extra description for the method, parameters, and return value are not displayed. Below is the snippet of my DLL source code:
///
/// InstanceCount property.
///
/// <value>The total number of the instances of CDemo.
public static long InstanceCount
{
get
{
return ClassInstanceCount;
}
}
///
/// Add two numbers together
///
/// <param name="a" />
/// First number.
///
/// <param name="b" />
/// Second number.
///
/// <returns>The total of two numbers
public int addNumber(int a, int b)
{
int c;
c = a + b;
return c;
}
Anything that I have missed over here?
Thanks for ur help
|
|
|
|
|
How do you "import" the dll? If you add the project to the solution, the dll file and xml file is automatically copied to the solutions bin folder.
Where did the xml go? The comments should look like this:
/// <summary>InstanceCount property.</summary>
/// <remarks>Gets the total number of instances of CDemo.</remarks>
public static long InstanceCount {
get {
return ClassInstanceCount;
}
}
/// <summary>Add two numbers together</summary>
/// <param name="a">First number.</param>
/// <param name="b">Second number.</param>
/// <returns>The total of two numbers</returns>
public int addNumber(int a, int b) {
int c;
c = a + b;
return c;
}
<small>---
b { font-weight: normal; }</small>
|
|
|
|
|
Hi Guffa,
I redid the dummy DLL project. Then import (right-click references from solution explorer) in a tester project, now I can see the explanation in intellisense.
Thanks alot for ur guidance
|
|
|
|
|
sorry, forgot to tick the "do not treat <'s as HTML tags".. here's another post.
Hi Guffa,
I have written some documentation to my DLL, build it, seen the .xml counterpart of the DLL. But as I test it in another project, having imported the dll, copy the xml over to this project's bin folder (is this necessary?), I still only see the method signature from my DLL as the quick info, the extra description for the method, parameters, and return value are not displayed. Below is the snippet of my DLL source code:
/// <summary>
/// InstanceCount property.
/// </summary>
/// <value>The total number of the instances of CDemo.</value>
public static long InstanceCount
{
get
{
return ClassInstanceCount;
}
}
/// <summary>
/// Add two numbers together
/// </summary>
/// <param name="a">
/// First number.
/// </param>
/// <param name="b">
/// Second number.
/// </param>
/// <returns>The total of two numbers</returns>
public int addNumber(int a, int b)
{
int c;
c = a + b;
return c;
}
Anything that I have missed over here?
Thanks for ur help
|
|
|
|
|
Hi
I have a program (buiusing windows API) that is running invisible and is being controled by shortcut keys. When a specific shortcut key is pressed i want to display a small image on top of the screen to inform the user that the operation succeeded or failed.
How do i display an image on top of the screen using windows API?
Thanks a lot
Mamtz
|
|
|
|
|
Of course, there are a thousand different ways to do this, but here is a very simple one: Just have a little hidden borderless window with a PictureBox having Dock property set to Fill; when you want to show the image, show the window, starting a timer that will stop itself and hide the window again after whatever interval you want.
Let stand for five minutes before serving. Season to taste. Enjoy.
Matt Gerrans
|
|
|
|
|
I forgot the name of an add-in I liked a lot.
It was drawing a vertical line between the brackets in my C# code. I believe it did refactoring too. Does anyone know what I'm talking about? I'd like to reinstall it.
Thanks!
Example:
if (0==1)
{
|
| Debug.WriteLine("Something is broken, Jimbo!");
|
}
|
|
|
|
|
|
|
|
Hi,
I would like to obtain the UITypeEditor for an object in C#. I looked at TypeDescriptor.GetEditor() but i'm not sure what it wants in the 'editorBaseType'. Does it want ' typeof(System.Drawing.Design.UITypeEditor)'? No matter what I do I always get 'null' returned.
Anyway, the reason I want to do this is I want to know the UITypeEditor used for a standard Boolean object so I can use it as the editor for my own custom boolean type. How can I find this?
Regards,
Shane
|
|
|
|
|
Look at the sample code Here.[^]
Although it's main purpose is to show how to create different shape controls, it has a very well documented code that shows how to create UITypeEditors.
|
|
|
|
|
Hi there,
Thanks for the reply, but I don't need to know how to write UITypeEditors, i've written plenty. It's more that I wanted to know how to obtain the UITypeEditor for the 'Boolean' type.
In any case, i've worked it out. The standard Boolean type converter supports standard values so they are expressed via a drop down box in the propertygrid.
Shane
Shane Stevens
Technical Director
Blue Tongue Entertainment
www.bluetongue.com
|
|
|
|
|
Hello,
I need to find out which row (in the DataTable) has been clicked by the user in the DataGrid. I know I can use HitTest() method of DataGrid, but that is for row and column in the DataGrid, not the DataTable i.e. If the user has sorted the records in the DataGrid, the row idices may be different from those in the DataTable.
e.g. if the user has sorted the records, Row 3 may be Row 0 in the DataTable, so I can't blindly go for Row 3 in the DataTable, I need to be sure of the actual row that has been clicked.
Any Ideas?
Thanks in Advance...
- A programmer's national anthem; "AAAAAHHHHH!!!!"
|
|
|
|
|
read the rowid value from grid you clicked
and search by this id in datatabe some thing like that
string IdVal=GetIDFromCell();
dataSet21.Customers.FindByCustomerID(valId);
MCAD
|
|
|
|
|
Can you please elaborate a little more?
Where are these functions to be defined, how are they to be implmented, etc...
- A programmer's national anthem; "AAAAAHHHHH!!!!"
|
|
|
|
|
Found this on Windows Forms FAQ (quoting verbatim without permission):
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q934q
... but if the grid has been sorted, you can no longer get at the current row in the table through the grid's CurrentRowIndex. But for both unsorted and sorted grids, you can get at the current row through the BindingContext and the Current property of the BindingManagerBase.
[C#]
BindingManagerBase bm = this.dataGrid1.BindingContextr[this.dataGrid1.DataSource, this.dataGrid1.DataMember];
DataRow dr = ((DataRowView)bm.Current).Row;
[VB.NET]
Dim bm As BindingManagerBase = Me.DataGrid1.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember)
Dim dr As DataRow = CType(bm.Current, DataRowView).Row
Me again. I've noticed that if my BindingManager is disconnected (e.g. bm.SuspendBinding() ) that this throws a wonderful exception. I wrap this in a try/catch block or check that bm.Current > -1.
robrich
|
|
|
|
|
private int currentGridRow = 0;
private int currentGridColumn = 0;
private void OnGridCurrentCellChanged(object sender, EventArgs e)
{
DataGridCell dataGridCell = this.dataGridAllocation.CurrentCell;
//Update Member Variables
this.currentGridRow = dataGridCell.RowNumber;
this.currentGridColumn = dataGridCell.ColumnNumber;
}
private void OnGridMouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
//Get Current Point
this.hitTestGridInfo = this.dataGrid.HitTest(new Point(e.X, e.Y));
if (hitTest.Type == DataGridEx.HitTestType.Cell )
{
DataRow row = GetDataRowAt(this.currenGridRow);
}
}
}
private DataRow GetDataRowAt(int index)
{
DataRow dataRow = null;
CurrencyManager currencyManager = null;
currencyManager = (CurrencyManager)this.BindingContext[this.dataTable];
if ( currencyManager != null )
{
dataRow = ((DataRowView)currencyManager.List[index]).Row;
}
return dataRow;
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
Thanks a lot for such a valuable advice, just one more question, why do we need to manually keep track of the current Row and Column, can't we use "CurrentCell" property directly in the OnGridMouseDown()?
- A programmer's national anthem; "AAAAAHHHHH!!!!"
|
|
|
|
|
And there's a problem again, the "CurrentCell" property's Row and Column are with respect to the Grid View (or that is how it is showing me), because when I sort the DataGrid, the ColumnNumber and RowNumber properties of "CurrentCell" cease to return the original row and column number, they return the new row and column number (with respect to the DataGrid) instead...
- A programmer's national anthem; "AAAAAHHHHH!!!!"
|
|
|
|
|
The following function takes care of the sorting. This will give you the exact datarow no matter whether it is sorted or not.
private DataRow GetDataRowAt(int index)
{
DataRow dataRow = null;
CurrencyManager currencyManager = null;
currencyManager = (CurrencyManager)this.BindingContext[this.dataTable];
if ( currencyManager != null )
{
dataRow = ((DataRowView)currencyManager.List[index]).Row;
}
return dataRow;
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
A very simple way is just to access the DefaultDataView.
Add the code below to the CurrentCellChanged event of the datagrid:
<br />
int currRow = myGrid.CurrentCell.RowNumber;<br />
DataView dv = (DataView)((DataTable)grdProduction.DataSource).DefaultView;<br />
I have used it only with DataTables. I don't know what will happen with other kinds of datasources.
|
|
|
|