|
In the article “Bending the .NET PropertyGrid to Your Will” , “Fruit enum” is define at design time and therefore the selection for property in to the PropertyGrid allow to select one of them. Is it possible to get the values form database on the fly and and allow user to select one of them.
Best Regards,
Hardew Singh
|
|
|
|
|
I suppose you could, but I don't really know how. I haven't used property grids yet.
I'll suggest you post this question in the article's own message board. You'll probably get better answers (including from the author, who knows a lot about his article (I suppose )).
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
It's been awhile since I've been deep into the property grids but yes you can do what you want to do. For valid values (which is what you talk about) there is a GetProperties() method or something like that that you override. You return the list of valid values in that call which can be from a database. Look at this article to get specifics.
MSDN Article on property grids[^]
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Yes it is Resize but is happen also if i resize manually the form, but i need to understand if the user has clicked on the maximize button.
How?
|
|
|
|
|
I am not sure if such an event is available but in the SizeChange event you
can check for
if ( this.WindowState == FormWindowState.Maximized )
{
...
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
|
Hi there. I'm running this website www.elefun.net for my company. It is an C# .net solution.
Most of the website/product information and user information is based on an Access db. I've got some negative comments about Access db's like:
1. Access db's are bad and should not be used.
2. Access do not handle large db's well.
So I've been considering to change to an SQL db for I while, but I really don't know if it's nesessary. My Access db is at the moment about 9MB. My questions are:
3. Is it OK to use acces db's for this kind of solutions?
4. Does Access db's get to large. If they do? When are they to large? 10MB, 100MB, 1GB. I really don't have any clue.
5. Is converting from an Access to an SQL db hard? I've worked some with both kinds of db's, but never tried converting between them. Will I have to do many changes in my solution, or will changing the db connection be it?
|
|
|
|
|
Access is a database meant for desktop use. It's not meant to be used in a web environment. Since Access databases don't compact themselves, with continued use, your database will get bigger and bigger over time. You'll have to shut down your website, launch Access, or some other tool, compact and repair the database, then bring your website back up.
Think about it. You're using a website that has the possiblity of growing. An Access database will be a large bottoneck in the performance of your site, should it get the traffic.
It's relatively easy to upsize an Access database to SQL Server. There's a tool built into Access to do it. It's just that what is generated by the tool might not be the best performing SQL. It's a decent short term solution, but you'd probably be better off re-writing for SQL Server by hand.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
1. Access is sometimes convenient, and works well if the demands of the application are not too great.
2. Depends on what you mean by "large".
3. I don't know. I have not used Access in a web application. I know that in a non web server environment that the more simultaneous users you have, and the larger the db, the more corruption problems I have had. I don't know if the same applies in a web app since there will probably only be 1 user (network Service account in win 2k3).
4. I did not have much problem until the database size exceeded at least 500MB or maybe a little larger. I had many corruption problems by the time the db reached 1GB. This was with about 10 to 15 simultaneous users with the mdb file on a network share.
5. It should not be too difficult to convert. I haven't worked with Access in a .Net environment, but in the old days, the date fields required slightly different delimiters than SQL Server.
Note: All my Access experience was with Access 97 using old ADO. I have not used Access in about 3 years.
|
|
|
|
|
4. The hard limit is at 2GB. But be warned: Regulary inserting and deleting in an Access db will result in a growing file. So even if you have 9 Mb of content your file can get a size beyond the 2 Gb limit.
|
|
|
|
|
Thanks for the help by all of you. It seems like I'll continue use the access db for a while. Then I'll have the time do develop a good alternative SQL db for later use.
About the growing size of the Acces db whenit's used. Will this growth be seen as the filesize so I can monitor the size by checking the file by FTP or other?
If my Access db need to be cleaned up. How do I do it? If the growth in size is caused by use, and not data...
|
|
|
|
|
Hi,
Just a quick question. Let's say I have the WebSphere MQ .NET libraries installed on my local machine, and in my C# code I use the directive 'using IBM.WMQ;'. Everything compiles successfully & runs well on my machine. But what happens when I run the app on another machine, one which may not have WebSphere installed? Will the executable error? Is there some way I can customize this error, perhaps by checking if a library is available before 'using' it in my C# code?
Thanks in advance,
Andrew
|
|
|
|
|
Um but to use classes from IBM.WMQ you had to reference some .dll library (or maybe it was referenced by default). It won't work at all if you don't have that .dll on another machine! One possible solution is to look at references in project explorer (VS.NET, dunno how it is on other IDEs) and in properties to that reference set Copy Local (or something like that) to true. Than you'll have copy of necessary .dll in application's \bin folder.
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
The best method is to make sure that the WebSphere is installed before you install your app or is installed with your app.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi guys,
I searched MSDN and google for some help, but I could only find very basic solutions. What I want to do is a little tricky I think, but there are Add-Ins out there which do it, so it has to be possible.
A want to write an Add-In and want to integrate it really into Outlook. So there should be a button on the left site (where the E-Mail, Calendar, Contact, and so on Buttons are). If this button is pressed, there should come up a frame (of course inside Outlook, as if you'd pressed the "E-Mail" button), where the data which is processed by my Add-In is shown.
Another feature should be, that you can add the data source my Add-In should use by adding an "E-Mail Account". So you should be able to add an additional servertype (I'm not shure if it's called that way, cause I only have the german version) and my Add-In should be able to read the information stored that way. By the way, if you choose the "additional servertype" of my Add-In there should of course be a custom frame, because Outlook will not be able to know, what information I need to get from the user.
I hope someone understood my describtion and knows some answers.
I understand, that this is a lot of stuff I'm asking, but if you have some tutorials or samples I would be very happy with that.
Stampede
|
|
|
|
|
|
Does anyone of you know how to create a makefile using c#?
The makefile should be in what format e.g txt?
Where should the makefile be stored? In the same directory as my c# file remoteassembly.cs where I wish to use the makefile to create an assembly
Lastly, how do I use nmake to execute the makefile?
Thanks for your help. I posted this request only because the book that I am using does not show the way and I am also confused with the explantion provided in the documentation.
|
|
|
|
|
This article[^] discusses using C# with nmake and includes a sample makefile. Hopefully it may be of some use to you.
Also take a look at the samples in the Framework SDK
\Program Files\Microsoft.NET\FrameworkSDK\Samples\quickstart
All these have makefiles.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
I am trying to populate a grid based on 7 table join. For this I wrote an SQL Query in front end and then I am filling the tables in a Data Set. Everything works fine. But, I have to display two more columns ( Token# and License#) in the data grid based on the same table column (for ex; Ast_Refnr) which I am able to achieve too. I have a Product ID column in table and based on the Product ID value I need to fill the values in the addition columns.
The additional columns that I am displaying or Token# and License#.
If Product ID is 1, then I need to display a value for the column Token# in data grid and License# must be blank. Also, if the Product ID is 4, then I need to display a value in column License# and Token# must be blank.
Since I am populating the above two columns in data grid based on the same table column AST_Refnr value, neither Token# is empty nor License#. I dont know how to use conditions while popualting the Data Grid. Below I am copying a bit of my code which I use for populating data grid.
sSQL = "SELECT A.PRD_PRODUCTTYPE, C.AST_REFNR+' - '+ convert(varchar,D.SHP_SHIPDATE,101) Token#, " +
"C.AST_REFNR+' - '+ convert(varchar,D.SHP_SHIPDATE,101) License#, B.PRDD_ProductID, " +
"E.ASTP_TEMPLATENAME, F.ASTS_STATUS_DESCRIPTION, C.AST_REFNR, D.SHP_SHIPDATE FROM " +
"PRODUCT A,PRODUCTDETAIL B,ASSET C,SHIPPING D,ASSETPRODUCTS E,ASSETSTATUS F, Contact G WHERE " +
"A.PRD_PRODUCTID = B.PRDD_PRODUCTID AND B.PRDD_PRODUCT_ORDERID=C.AST_PRODUCT_ORDERID AND " +
"C.AST_ASSETID=D.SHP_ASSETID AND C.AST_DEFID=E.ASTP_DEFID AND C.AST_STATUSID=F.ASTS_STATUSID " +
"AND AST_ICA = '" + SearchForm.strPrimary + "' AND G.CNT_ContactID = D.SHP_contactID " +
"AND A.PRD_DELETED=0 AND B.PRDD_DELETED=0 AND C.AST_DELETED=0 AND D.SHP_DELETED=0 AND " +
"E.ASTP_DELETED =0 AND F.ASTS_DELETED=0 AND G.CNT_Deleted = 0 ORDER BY A.PRD_PRODUCTTYPE";
OdbcDataAdapter da = new OdbcDataAdapter(sSQL, con);
da.Fill(ds, "Product");
da.Fill(ds, "AssetProducts");
dataGrid1.DataSource = ds.Tables[0].DefaultView;
DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.RowHeadersVisible = false;
DataGridTextBoxColumn column1 = new DataGridTextBoxColumn();
column1.MappingName = "PRD_PRODUCTTYPE";
column1.HeaderText = "Product";
column1.Width = 70;
tableStyle.GridColumnStyles.Add(column1);
this.dataGrid1.TableStyles.Add(tableStyle);
tableStyle.MappingName = "Product";
--- This value I need to display in data grid if PRD_ProductID is 1
DataGridTextBoxColumn column6 = new DataGridTextBoxColumn();
column6.MappingName = "Token#";
column6.HeaderText = "Token#/ShippedDate";
column6.Width = 150;
tableStyle.GridColumnStyles.Add(column6);
this.dataGrid1.TableStyles.Add(tableStyle);
--- This value I need to display in data grid if PRD_ProductID is 4
DataGridTextBoxColumn column7 = new DataGridTextBoxColumn();
column7.MappingName = "Lic#";
column7.HeaderText = "License#/ShippedDate";
column7.Width = 150;
tableStyle.GridColumnStyles.Add(column7);
this.dataGrid1.TableStyles.Add(tableStyle);
This forum has helped me a great deal and again I am approaching this for help. Thanks everyone in advance.
Looney
|
|
|
|
|
Hope this helps,
Subscribe to DataTable.RowChanged event. In the event handler, check for the
DataRowAction.Add.
Then depending on the values of Product ID , set the values of Token# and License#.
Then call DataTable.AcceptChanges()
Here is some code snippet, please change accordingly
Private myTable As DataTable
Private Sub [AddHandler]()
myTable = CType(datagrid1.DataSource, DataTable)
AddHandler myTable.RowChanged, AddressOf Me.myDataTable_Changed
End Sub
Private Sub myDataTable_Changed _
(ByVal sender As System.Object, ByVal e As System.Data.DataRowChangeEventArgs)
Console.WriteLine("Row Changed", e.Action, _
e.Row.Item(datagrid1.CurrentCell.ColumnNumber))
End Sub
Live Life King Size
Alomgir Miah
|
|
|
|
|
This will be a lame question to those who know classes well, so go easy on me. I understand how to make simple classes, like one that can hold peoples' names and addresses). But I need to make one that can hold an array with an array. Here's my goal: I'd like to populate a class (array?) of server names, but I get confused when I try to have THAT class have an array of its own to hold all the services for each server. I hope that makes sense. Using 2D arrays is the easy method, I know, but I have to grasp classes at some point. Thank you for any help.
-Michael
|
|
|
|
|
An array is just a data structure, not a class on its own
An ArrayList, on the other hand, is a class - it has both data and behavior (methods) related to that data.
For what you want to do, an ArrayList (or perhaps even better a HashTable) would be a good choice. An arraylist instance contains a list of objects ( your servers, which could be your list of services, perhaps complex objects themselves, or just simple string service names).
public class Servers
{
private HashTable ServerList = new HashTable();
public Servers(){};
public void Add(string Servername, Server s)
{
ServerList.Add(serverName, s);
}
public Server GetServer( string serverName)
{
return (Server)Serverlist[Servername];
}
}
public class Server
{
private HashTable ServicesList = new HashTable();
private string serverName = string.Empty;
public Server(string ServerName)
{
this.serverName = Servername;
}
public void AddService( string serviceName, Service srv)
{
ServiceList.Add(serviceName,srv);
}
}
and so on...
Note code above is off the top of the head, errors likely.
[edit]
I used a HashTable, because it gives very fast lookups of the key for even large lists. With the ArrayList, lookups are linear with the number of entries, but it is easier to iterate (and to conceptualize).
[/edit]
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
I appreciate the reply. One thing is still unclear, though. How do you call up each element specifically? As with treeviews, for example, you can add or recall a specific part by using "treeView1.Nodes[15].Text", or to get to that node's child you use "treeView1.Nodes[15].Nodes[0].Text", and so on.
I understand what you mean above, but I'd just like some clarification on how to get the data at a specific point by using the indexes of the array.
-Michael
|
|
|
|
|
Note the GetServer function provided in the original example. That retrieves the server stored with the servename passed as a parameter. Hashtable stores by key, rather than index (you can get data by index as well, but this is not particularly useful as the indeces have nothing to do with the order added)
For an arrayslist, the index will be the same as the order added.
items in a hashtable are DictionaryEntry objects: a key and value pair,
and the 'indexer' is the key value (can be any object that supports GetHashCode() and Equals()- string, Int32, etc. wotk fine) the indexer returns a generic object reference to the value originally associated with the key
So, if tbl is the Hashtable name:
Server s1 = new Server("server1");
tbl.Add("server1",s1);
Server s1 = (server)tbl["server1"];
For an Arraylist, indexing is by integer indx, just like an array, and what is
returned is a generic object reference. So, if Arr is the Arraylist of Server objects:
Server s1 = (Server)Arr[0];
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|