|
|
hai there,
give a little idea about macros and development using VSIDE. Other wise mention any links which explaines VS macros.
Sreejith S S Nair
|
|
|
|
|
It's all in the VS.NET product documentation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
hi all.
In my program I need to convert a double number to string representation in fraction format and vise versa. For example, convert 0.75 to string "3/4" and convert string "1/2" to 0.5. The class will only need to handle numbers that increment by 1/32. That is 1/32, 2/32, 3/32.... 31/32, 1. If the double number is 0.28 which is between 1/4 and 9/32, the string should be 9/32(go with the bigger number).
TIA
|
|
|
|
|
See the example source code for my article, Custom String Formatting for .NET[^], which includes a Rational class (a pretty common implementation). That should do what you need and then some.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
Can i get the value of current source column that failed to transform to the destination column in an OnError Event of a DTS package? I want to insert this failed value to a table for data maintenance.
Thanks for the help.
|
|
|
|
|
|
Thx for your reply. Sorry for the lack of information. I'm using C# to build windows application to execute a dts package and i set an event handler for the OnError Event. So, when the error occurs i want to take the value of source field that failed to be transformed.
|
|
|
|
|
There is no information passed to the OnError event handler that would give you any such information. You should look at the documentation for the OnError event in the DTS Programming Reference either in the SQL Server docs or in MSDN Library[^].
My only other thought is to examine several of the string parameters to see if any additional error information is returned that you could parse, but judging by what the documentation says it seems unlikely.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear CPians,
I have been assigned to develop a Custom PropertyGrid with look and fill like the link below.
http://www.visualhint.com/feature5.php
In the PropertyGrid value cells, I am assigned to display the controls like NumericUpDown, RadioButtons, CheckBox, ListBox etc.I read several articles both in CP and MSDN and gathered the following informations. I request the CPians to comment on the below points(point 1 to point 3)
1.It is not possible to host a control in the value area of the PropertyGrid. It is however possible to draw the control in that area if we have the correct UITypeEditor.
2.The thumbnail of images can be displayed next to image data in the property grid. (Displaying control in the complete cell area is not possible[Actually I wanted to display NumericUPDown control in the cell])
3.There is no "official/documented" way to customize that error box. PropertyGrid component displays the error in its own dialog.
Information Required:
4.Considering the above facts, I wanted to go for some third party tool which gives the similar facilities and can be used as a control component in the project that is using C#.Net as development environment. But I did not get any. All the components are written using MFC unmanaged code. I want the component, written in mananaged environment, so that I can use it in C#.net development environment with ease. I request the CPians to share the information in this regard, if you know any such components.
Thanks in advance.
Regards,
Jay.
|
|
|
|
|
A UITypeEditor won't allow you to place controls in the value region of the PropertyGrid in the .NET FCL, but it can display a popup window (like for the Control.Dock property) using the IWindowsFormsEditorService .
The important thing is to read the .NET Framework SDK for the System.ComponentModel namespace, and remember that it doesn't matter what language you write this in. All languages targeting the CLR compile to IL, so you can write this in C# and use it for VB.NET, Perl.NET, and many others.
For example, to get the collection of properties, you'd call TypeDescriptor.GetProperties . This even allows you to filter the properties with an array of attributes. You could, for example, pass an instance of the BrowsableAttribute(false) as one of the elements in the Attribute[] array so that non-browsable properties are not displayed (default behavior).
The .NET component model provides pretty much all the services you need. You should also implement certain services like the IWindowsFormsEditorService and other services that support UITypeEditor s.
You should also examine how the System.Windows.Forms.PropertyGrid currently works either by using ildasm.exe (the IL Disassembler, part of the .NET Framework SDK, if you know how to read IL), or a decent decompiler like .NET Reflector[^].
You might also consider comprimising on a few things, like being able to host a control inside the PropertyGrid itself. Once you dig into the managed implementation for the PropertyGrid , you'll find it's not so easy doing the correct way (using the component model, which is still the easiest way).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
Rather than going for managed implementation for the PropertyGrid, I think I should compromise the following :
1.Hosting the control inside the PropertyGird value cell.
2.Customizing the error dialog box of the PropertyGrid Control.
I will put forward this to our management, since our main focus is not of component development.
Thanks once again for your valuable suggestion.
Best Regards,
Jay.
|
|
|
|
|
I have done something like this, but I tackled it from the other side.
I basically recreated the PropertyGrid's behaviour in my own control, and let the editors/convertors do there work.
|
|
|
|
|
How to create a process bar like this:
<br />
+------------------------------------------+<br />
| Processing....... |<br />
|------------------------------------------|<br />
| |<br />
| Please wait...... |<br />
| +-----------------------------------+ |<br />
| | | | | | | | | | | | |<br />
| +-----------------------------------+ |<br />
| 50 % |<br />
| 10 Second Remaining |<br />
+------------------------------------------+<br />
Thanks.
Rock Throught The Night
|
|
|
|
|
Use the ProgressBar and a few Label controls. If you want to treat this whole thing as a single control, consider extending UserControl and put all this in it. Add some properties and methods to that user control, such as a Minimum , Value , and Maximum properties, and perhaps a Step method (similar to the ProgressBar ). These would be used to set the properties on the ProgressBar , and when the Value is updated, also update the Label with the percent remaining (although the addition of such a control and a progress bar is a waste of screen real estate).
As far as time remaining, that's really a question of implementation. There's no generic way of handling it. You have to calculate or estimate the total and remaining time as you perform your operations.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
but how to calculate or estimate the total and remaining time as you perform your operations.
thanks
Rock Throught The Night
|
|
|
|
|
Like I said - it's completely dependent on your implementation. If you were download a file or files, for example, you'd get the total number of bytes for the max value, increment the current value as you download bytes, and keep a running average that you'd use to estimate the time.
Only you can answer this question. If you've estimated that each operation takes 5 minutes, the multiple the number of operations by 5 and decrement in 5 minute intervals. Again, only you can say.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok
thanks
Rock Throught The Night
|
|
|
|
|
I have put a few of these together, and determining the percentages and getting the bar to move properly is not the easiest if you do it yourself.
For example: if you have a task you want to show this progress bar for and you created a record, notified one server of the new record, notified the database queue of the record, then created a summary page of the data, then you would have four tasks. However you can only set the value to 0, 25, 50, 75, 100 for those four values.
If, however, you take a look at here :
Pretty Good Splash Screen[^]
it contains the code to do a smooth progress bar. You can take the snippet of code from here and it manages the real time for each task. The first iteration it displays a blank page. All remaining iterations it displays a smooth progress bar.
Enjoy
______________________________
The Tao gave birth to machine language.
Machine language gave birth to the assembler.
The assembler gave birth to ten thousand languages.
Each language has its purpose, however humble.
Each language expresses the Yin and Yang of software.
Each language has its place within the Tao.
Beauty exists because we give a name to C#.
Bad exists because we give a name to COBOL.
|
|
|
|
|
Hello:
Is there any web site where I can find a very good explanation about the use of properties and mainly the justification of this in Database fields or (web)Forms fields ?
Many thanks!!!
|
|
|
|
|
You mean class properties? I don't see how this relates to databases or web form fields. If you are talking about creating business objects that map logical business data models (not a one-for-one mapping to a database, which is a poor design), then it's because it abstracts the actual data model away, leaving your code with an abstract way of declaring and using the relationships between your business objects. You can then implement a data tier which uses this information and updates the database. With an abstract design, you could always use a different data tier implementation to talk with different databases or even different data sources (like XML files).
If you mean class properties, this comes down to common object-oriented programming. The ubiquitous example is the Person and Company classes. Properties of these classes define the name of a person or company and other data associated with an instance of the class. You define methods when you actually want to perform an operation on that class.
If you're new to object-oriented development, I suggest you pick up a good book from www.amazon.com[^], or try a google search on object-oriented development[^]. The concept of properties and methods is common to all true object-oriented languages, like all the ".NET Languages" (those targeting the common language runtime, or CLR) and Java.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
It is difficult to tell exactly what you are asking here - but if you talking about directly mapping database fields to a text box (or similiar control) on a form (of course, as the other message said, this is not a recommended OO methodology) but I'll use it sometimes for test purposes etc. If you are using Sql server you can use the following query to simply query the field metadata from Sql's System Tables. You can then loop through this recordset and assign the fields to the corresponding Form controls. If you are consistent with your naming conventions (i.e., naming the controls the same name as the fields) you can do this in one simple loop. In addition, you can setup your Update procedure and Insert procedure parameters in the same loop. As mentioned before, I wouldn't do this for a production App - but works great to model try some test cases or work up a quick "demo" etc...
Here is query to extract field meta data, this will work for a Table or a View since Sql stores the Columns Definitions for both in the same system tables. If you are using a Sproc for your select, the query is a little more complext but I can send that to you as well if you need it. Hope that helps...
ALTER PROCEDURE dbo.GetFields
(
@TableName varchar(128)
)
AS
SELECT
o.sysObjectID,
o.sysTableName,
c.name AS sysFieldName,
c.xtype AS sysDataTypeID,
t.name AS sysDataType,
c.length AS sysFieldSize,
c.colid AS sysOrdinalPosition,
c.isoutparam AS sysIsOutputParameter,
ISNULL(c.scale, 0) AS sysScale,
c.prec AS sysPrecision
FROM
dbo.systables o
INNER JOIN
dbo.syscolumns c
ON
o.sysObjectID = c.id
INNER JOIN
dbo.systypes t
ON
c.xtype = t.xtype
WHERE
o.sysTableName = @TableName
ORDER BY
c.colid
|
|
|
|
|
To add to this (for the original poster), a more common data-binding example is to bind against a DataSet , or a business object like I mentioned. Either one could be filled from a data source using the provider pattern so that the implementation is really independent from the data. This is a good OO design.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi Heath,
After I add a row to a dataset how can I update that same row in the dataset after it has been added?
Thanks,
JJ
|
|
|
|
|
I was thinking the LoadDataRow method but this querys the Primary key for row which doesn't exist yet since generated by the database when records from dataset gets inserted. Or maybe I can't use an autoincrement field in the database table anymore because I have to supply one for new row inserts into dataset? Any Ideas?
Thanks,
JJ
|
|
|
|
|