|
Great! Hopefully that'll stem the tide a little. It's important that something like that start off right, with a good content base. Have you thought about letting the community put in content, with the editors having the ability to weed out the bad, or maybe have a little approval process? That'd still give you the chance to edit the content for correctness and wording.
-Jeff
here, bloggy bloggy
|
|
|
|
|
CP doesn't really have the architecture for it - that would be more of a Wiki sort of thing. But we're definitely open to some input.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Well, in the meantime I'm sure that people can always send you an email request if they feel strongly about something. Architectural changes would just make it a little easier in the long run. Maybe you should consider setting up an email account just to receive requests, and post a link to it at the top of the page serving the content. Also, you could pretty easily just create an extra ASP page to take suggestions for the FAQ, which would send it to an email address that you guys could check on an infrequent basis.
Just the word "Wiki" is tantalizing.
-Jeff
here, bloggy bloggy
|
|
|
|
|
|
GOOD IDEA! FAQ I like it.
/\ |_ E X E GG
|
|
|
|
|
Hello,
I'm looking for a better way to update a dataset (update my xml-file actually) when i click a button this is what happens:
if(result == DialogResult.Yes)<br />
{<br />
int del = dtgLibrary.CurrentRowIndex ;<br />
ds.Tables["library"].Rows[del].Delete();<br />
ds.WriteXml(@"c:\library.xml");<br />
ds.ReadXml(@"c:\library.xml"); <br />
btnAddL.Visible=true;<br />
File.Delete(@"c:\library.xml");<br />
}
Is there a better way to do this? because like this you create a file and delete it again
thx in advance
|
|
|
|
|
Why are you reading it back in and then deleting it? The DataSet remains unchanged after using WriteXml . If you want to accept changes made to the DataSet , call DataSet.AcceptChanges() .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to associate a contextMenu control not with a whole TreeView control, but with a certain element(TreeNode) so that the options of the contextMenu depend on the item and its level in the TreeView. Do I need only one contextMenu and update it at runtime through code (handling its popup event?)? Or can I have more contextMenus? (and in this case how can I associate them with the different nodes of the TreeView).
I hope I have been clear enough and not give you head aches.
Thank you in advance.
Best regards,
Cristina
|
|
|
|
|
Cristina,
I am doing something like this right now actually.
Since the TreeNodes don't have a ContextMenu associtated with them, the thing to do is change the ContextMenu associate with the parent TreeView based on where the cursor is. Do this by handling the MouseMove event on the TreeView control. I derive a new class of TreeNode for each "kind" of node I use. This lets you use the node type to decide which menu to show.
Something like:
private void treeView1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
TreeNode tn=treeView1.GetNodeAt(treeView1.PointToClient(System.Windows.Forms.Cursor.Position));
if (tn!=null)
{
switch (tn.GetType ().ToString ())
{
case "DerivedTreeNodeClass1":
this.ContextMenu = ContextMenu1;
break;
case "DerivedTreeNodeClass2":
this.ContextMenu = ContextMenu2;
break;
default:
this.ContextMenu = DefaultContextMene;
break;
}
}
else
{
this.ContextMenu = null;
}
}
You can use the same idea and handle it on popup too...at least I can't think of a reason why that wouldn't work. You also don't need to derive new TreeNode classes. You just need some way to tell, from the node itself, what menu you need to show.
Hope this helps,
Bill
|
|
|
|
|
An alternate technique is to handle the ContextMenu object's Popup event, and manually add and remove menu items as appropriate. See the documentation for ContextMenu.Popup .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Absolutely. It's still the same basic idea though, right?
1) Identify the node being rt-clicked using the GetNodeAt()
2) Decide what to display for a context menu based (at least in part) on the node.
As a general caveat: Be aware that you are not guaranteed to be over the node when the Click event on the MenuItem fires. So no matter which approach you take to drawing the menu, make sure you grab the TreeNode when you draw it if you are going to need the node to handle the Click event (which more often than not, I do.)
Bill
|
|
|
|
|
Yeah, Only one ContextMenu is enough.
You can change the visibility of the MenuItems in the Popup or TreeView's AfterSelect event.
In the AfterSelect event, you will have the TreeNode object in hand, therefore you can easily associate the MeniItems with the TreeNode.
|
|
|
|
|
hi everyone
i am working in .NET writing C# and using SQL as my database.
i am tring to retrieve into a drop down list a sertion row from my database.
here is what i did:
SqlConnection cn = new SqlConnection("...");
cn.Open();
DataSet ds = new DataSet();
SqlDataAdapter da =new SqlDataAdapter("spSelectCityDesc",cn);
da.Fill(ds);
ddlCity.DataSource=ds;
ddlCity.DataBind();
ddlCity is a drop down list.
but it is not working!!
the return values (in the ddl) are:
"System.Data.DataRowView" as many times as the number of rows in the wanted table.
do anyone have an idea ?
what should i do?
|
|
|
|
|
err... Set the DisplayMember property on the ListBox?
Set it to a string = to the name of the field you want to display.
Bill
|
|
|
|
|
Also set the ValueMember otherwise the values will be full of the same.
You should also set ddlCity.DataMember to the table name (probably "Table") in the DataSet , or set ddlCity.DataSource = ds.Tables[0]; (if ds != null - never forget error checking!).
Finally, this really belongs in the ASP.NET forum. Since you're calling DataBind - which isn't needed and doesn't even exist in Windows Forms - this is obviously an ASP.NET-related question.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I am using the decision tree created by roosvelt and I want to know how to make the target nodew accepts string.Soif any one knowshowto contact roosveltorknows about the decision tree mining algorithm can help me
|
|
|
|
|
If you ask this bloody question one more time, I will personally make sure they ban you off this site. Use Google groups! (and use spaces)
|
|
|
|
|
hai,
i have three methods. one to one interrelated.
Method A Calls Method B and Method B Calls Method C.
my aim is if method C raises any exception i need to catch on method B. And this exception is showed to user on method A.
note: Exception Reporting.
What's your idea ? please help me out.
hai, feel free to contact
Sreejith SS Nair
|
|
|
|
|
I am guessing Method B does some exception handling, which is why it is being caught there and not in Method A.
public void MethodA()
{
string errorMessage = MethodB();
if (errorMessage != "")
{
}
}
public string MethodB()
{
try
{
MethodC();
}
catch(Exception ex)
{
return ex.Message
}
return "";
}
public void MethodC()
{
throw(new ApplicationException("Something went wrong"));
}
This is one way of doing it. But, as you've not expressed fully what you are trying to do, it may not fit with the design of your application.
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
PropertyGrid control always shows a ToolTip when mouse pointer is placed on a property with a large value that is not fully visible in the field. Is there a way to display limited text in tooltip or turn this behavior off?
How to tell PropertyGrid not to show any ToolTip at all?
Thanks for your help
|
|
|
|
|
It is just wierd, I have something like:
ArrayList al1 = .... //filled with some data
combobox1.DataSource = al1;
it is all OK.
BUT, later I have to change the contents of the combobox, so:
ArrayList al2 = .... //filled with something else
combobox1.DataSource = al2;
here cames up with a null DataSource (al2 is correct and no errors are shown).
I also tried to get the ArrauList back:
ArrayList al = (ArrayList)combobox1.DataSource;
al.Add("...");
.....
but nothing changed.
What could be wrong ? I would prefer the first approach.
|
|
|
|
|
varadii wrote:
What could be wrong ?
I've not double checked this, so this may not be right....
When you assign something to the ComboBox.DataSource the ComboBox knows that the source of the data is different and will update its contents accordingly. However if you just add an element to the array the ComboBox knows nothing of this and won't update. So, you have to tell the ComboBox that the array has changed. (Possibly by just assigning the Array back to the datasource)
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
Coming soon: The Second EuroCPian Event
|
|
|
|
|
hai,
give me detailed description or usefull link which will help me to update more than one table.
expecting advanced level.excuse basic level
hai, feel free to contact
Sreejith SS Nair
|
|
|
|
|
You can ask a little nicer.
Selecting multiple tables from a database and filling a DataSet with multiple DataTable s is easy (using a table mapping). Updating in the same way is not. The common approach is to use separate SqlDataAdapter s for each table, taking the necessary order (derived from the DataRelation s, or just hard-code it at design-time if you know it up front) into account.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi!
I need to use GPC library in a C# project.
GPC library is written in pure C and is available on http://www.cs.man.ac.uk/aig/staff/alan/software/
So what I did is I worte a Win32 .dll with exports of the library functions:
extern "C"
{
__declspec(dllexport) void gpc_add_contour(gpc_polygon *polygon, gpc_vertex_list *contour, int hole);
__declspec(dllexport) void gpc_polygon_clip(gpc_op set_operation, gpc_polygon *subject_polygon, gpc_polygon *clip_polygon, gpc_polygon *result_polygon);
....etc...
}
So I was thinking...ok...now I have the .dll and now I can use C# attribute DllImport to import functions from .dll.
But as you can see there are structures that pass as pointers to the functions. I don't know how to marshal it/make it usable in C#.
This is my current progress in implementing the port of GPC to C# (I don't know when to use IntPtr or something else):
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace nsGPC
{
public class GPC
{
public enum gpc_op
{
GPC_DIFF,
GPC_INT,
GPC_XOR,
GPC_UNION
}
[StructLayout(LayoutKind.Sequential)]
public class gpc_vertex
{
public double x;
public double y;
}
[StructLayout(LayoutKind.Sequential)]
public class gpc_vertex_list
{
public int num_vertices;
public IntPtr vertex; //pointer to gpc_vertex
}
[StructLayout(LayoutKind.Sequential)]
public class gpc_polygon
{
public int num_contours;
public IntPtr hole; //pointer to int
public IntPtr contour; //pointer to gpc_vertex_list
}
[StructLayout(LayoutKind.Sequential)]
public class gpc_tristrip
{
public int num_strips;
public IntPtr strip; //pointer to gpc_vertex_list
}
[DllImport("GPC.NET.dll", CharSet=CharSet.Ansi)]
public static extern void gpc_add_contour(ref gpc_polygon polygon, ref gpc_vertex_list contour, int hole);
[DllImport("GPC.NET.dll", CharSet=CharSet.Ansi)]
public static extern void gpc_polygon_clip(gpc_op set_operation, ref gpc_polygon subject_polygon, ref gpc_polygon clip_polygon, ref gpc_polygon result_polygon);
[DllImport("GPC.NET.dll", CharSet=CharSet.Ansi)]
public static extern void gpc_free_polygon(ref gpc_polygon polygon);
}
}
Well, anyways...Is anyone here with enough knowledge of porting this library to C#?
MP.
|
|
|
|