|
hi
i want to show the autogenerated delete button in grid view on some selected rows can anybody help me
|
|
|
|
|
I want to write an application which deletes SMS(System Management Server) client log files....
Any one here could provide me with a logic to write such application....or to provide me with an example...
Thanks a lot
|
|
|
|
|
Hello everybody!
I'm working on an application which has UserControls (GUI pages) with TabControls on it.
This TabControls are Usercontrols derived from Windows.Forms.TabControl.
Same to TabPage.
The TabPage class has a "Visible" property which removes the TabPage from TabControl.TapPages property, if it's set to false.
This Visible property is refreshed over an userdefined binding mechanism.
This means if I change my page, the Visible property of the TabPages will be refreshed.
On default the SelectedIndex property of the TabControl is set to "0".
Now what's my problem:
I allways had strange visual effects as the TabPages where removed from the Collection.
I saw the different TabPages flickering until all the TabPages where removed.
Thank's to Lutz Roeder's reflector I found out that the framework is forcing the SelectedIndex property after removing the tabpage.
public override void Remove(Control value)
{
base.Remove(value);
if (value is TabPage)
{
int index = this.owner.FindTabPage((TabPage) value);
if (index != -1)
{
this.owner.RemoveTabPage(index);
this.owner.SelectedIndex = Math.Max(index - 1, 0);
}
this.owner.UpdateTabSelection(false);
}
} I now whant to find a solution which prevents the SelectedIndex property to change when removing a TabPage.
What I was thinking of:
As the SelectedIndex property is not virtual I'm not able to override it in my TabControl class.
Maybe I could inherit a TabPageCollection class, for my TabPages property of TabControl class, which overrides the "Remove" method. And after that ????
Thanks for your time.
All the best,
Martin
|
|
|
|
|
hi friends....
I have got a problem regarding loading of multiple assemblies, actually its required for an editor which implements the intellisenseas in vb or dotnet.
for that it is required to load that assembly whose sub-classes are required to be loaded into the list box after pressing dot.
for example in the code given below i have given the path of System.dll assembly file, now all the sub class of System.Data are automatically displayed in list box but if i need to load more than one assmbly i.e 5-6 assemblies how should i do that.
source code
private void readAssembly()
{
this.treeViewItems.Nodes.Clear();
namespaces = new Hashtable();
Type [] assemblyTypes = assembly.GetTypes();
this.treeViewItems.Nodes.Clear();
// Cycle through types
foreach (Type type in assemblyTypes)
{
if ( type.Namespace != null )
{
if ( namespaces.ContainsKey(type.Namespace) )
{
// Already got namespace, add the class to it
TreeNode treeNode = (TreeNode) namespaces[type.Namespace];
treeNode = treeNode.Nodes.Add(type.Name);
this.addMembers(treeNode,type);
if ( type.IsClass )
{
treeNode.Tag = MemberTypes.Custom;
}
}
else
{
// New namespace
TreeNode membersNode = null;
if ( type.Namespace.IndexOf(".") != -1 )
{
// Search for already existing parts of the namespace
nameSpaceNode = null;
foundNode = false;
this.currentPath = "";
searchTree(this.treeViewItems.Nodes,type.Namespace,false);
// No existing namespace found
if ( nameSpaceNode == null )
{
// Add the namespace
string[] parts = type.Namespace.Split('.');
TreeNode treeNode = treeViewItems.Nodes.Add(parts[0]);
string sNamespace = parts[0];
if ( !namespaces.ContainsKey(sNamespace) )
{
namespaces.Add(sNamespace,treeNode);
}
for (int i=1;i < parts.Length;i++)
{
treeNode = treeNode.Nodes.Add(parts[i]);
sNamespace += "." +parts[i];
if ( !namespaces.ContainsKey(sNamespace) )
{
namespaces.Add(sNamespace,treeNode);
}
}
membersNode = treeNode.Nodes.Add(type.Name);
}
else
{
// Existing namespace, add this namespace to it,
// and add the class
string[] parts = type.Namespace.Split('.');
TreeNode newNamespaceNode = null;
if ( !namespaces.ContainsKey(type.Namespace) )
{
newNamespaceNode = nameSpaceNode.Nodes.Add(parts[parts.Length-1]);
namespaces.Add(type.Namespace,newNamespaceNode);
}
else
{
newNamespaceNode = (TreeNode) namespaces[type.Namespace];
}
if ( newNamespaceNode != null )
{
membersNode = newNamespaceNode.Nodes.Add(type.Name);
if ( type.IsClass )
{
membersNode.Tag = MemberTypes.Custom;
}
}
}
}
else
{
// Single root namespace, add to root
membersNode = treeViewItems.Nodes.Add(type.Namespace);
}
// Add all members
if ( membersNode != null )
{
this.addMembers(membersNode,type);
}
}
}
}
}
///
/// Adds all members to the node's children, grabbing the parameters
/// for methods.
///
/// <param name="treeNode" />
/// <param name="type" />
private void addMembers(TreeNode treeNode,System.Type type)
{
// Get all members except methods
MemberInfo[] memberInfo = type.GetMembers();
for (int j=0;j < memberInfo.Length;j++)
{
if ( memberInfo[j].ReflectedType.IsPublic && memberInfo[j].MemberType != MemberTypes.Method )
{
TreeNode node = treeNode.Nodes.Add(memberInfo[j].Name);
node.Tag = memberInfo[j].MemberType;
}
}
// Get all methods
MethodInfo[] methodInfo = type.GetMethods();
for (int j=0;j < methodInfo.Length;j++)
{
TreeNode node = treeNode.Nodes.Add(methodInfo[j].Name);
string parms = "";
ParameterInfo[] parameterInfo = methodInfo[j].GetParameters();
for (int f=0;f < parameterInfo.Length;f++)
{
parms += parameterInfo[f].ParameterType.ToString()+ " " +parameterInfo[f].Name+ ", ";
}
// Knock off remaining ", "
if ( parms.Length > 2 )
{
parms = parms.Substring(0,parms.Length -2);
}
node.Tag = parms;
}
}
///
/// Searches the tree view for a namespace, saving the node. The method
/// stops and returns as soon as the namespace search can't find any
/// more items in its path, unless continueUntilFind is true.
///
/// <param name="treeNodes" />
/// <param name="path" />
/// <param name="continueUntilFind" />
private void searchTree(TreeNodeCollection treeNodes,string path,bool continueUntilFind)
{
if ( this.foundNode )
{
return;
}
string p = "";
int n = 0;
n = path.IndexOf(".");
if ( n != -1)
{
p = path.Substring(0,n);
if ( currentPath != "" )
{
currentPath += "." +p;
}
else
{
currentPath = p;
}
// Knock off the first part
path = path.Remove(0,n+1);
}
else
{
currentPath += "." +path;
}
for (int i=0;i < treeNodes.Count;i++)
{
if ( treeNodes[i].FullPath == currentPath )
{
if ( continueUntilFind )
{
nameSpaceNode = treeNodes[i];
}
nameSpaceNode = treeNodes[i];
// got a dot, continue, or return
this.searchTree(treeNodes[i].Nodes,path,continueUntilFind);
}
else if ( !continueUntilFind )
{
foundNode = true;
return;
}
}
}
///
/// Searches the tree until the given path is found, storing
/// the found node in a member var.
///
/// <param name="path" />
/// <param name="treeNodes" />
private void findNode(string path,TreeNodeCollection treeNodes)
{
for (int i=0;i < treeNodes.Count;i++)
{
if ( treeNodes[i].FullPath == path )
{
this.findNodeResult = treeNodes[i];
break;
}
else if ( treeNodes[i].Nodes.Count > 0 )
{
this.findNode(path,treeNodes[i].Nodes);
}
}
}
///
/// Called when a "." is pressed - the previous word is found,
/// and if matched in the treeview, the members listbox is
/// populated with items from the tree, which are first sorted.
///
/// <returns>Whether an items are found for the word
private bool populateListBox()
{
bool result = false;
string word = this.getLastWord();
//System.Diagnostics.Debug.WriteLine(" - Path: " +word);
if ( word != "" )
{
findNodeResult = null;
findNode(word,this.treeViewItems.Nodes);
if (this.findNodeResult != null )
{
this.listBoxAutoComplete.Items.Clear();
if ( this.findNodeResult.Nodes.Count > 0 )
{
result = true;
// Sort alphabetically (this could be replaced with
// a sortable treeview)
MemberItem[] items = new MemberItem[this.findNodeResult.Nodes.Count];
for (int n=0;n < this.findNodeResult.Nodes.Count;n++)
{
MemberItem memberItem = new MemberItem();
memberItem.DisplayText = this.findNodeResult.Nodes[n].Text;
memberItem.Tag = this.findNodeResult.Nodes[n].Tag;
if ( this.findNodeResult.Nodes[n].Tag != null )
{
System.Diagnostics.Debug.WriteLine(this.findNodeResult.Nodes[n].Tag.GetType().ToString());
}
items[n] = memberItem;
}
Array.Sort(items);
for (int n=0;n < items.Length;n++)
{
int imageindex = 0;
if ( items[n].Tag != null )
{
// Default to method (contains text for parameters)
imageindex = 2;
if ( items[n].Tag is MemberTypes)
{
MemberTypes memberType = (MemberTypes) items[n].Tag;
switch ( memberType )
{
case MemberTypes.Custom:
imageindex = 1;
break;
case MemberTypes.Property:
imageindex = 3;
break;
case MemberTypes.Event:
imageindex = 4;
break;
}
}
}
this.listBoxAutoComplete.Items.Add(new GListBoxItem(items[n].DisplayText,imageindex) );
}
}
}
}
return result;
}
///
/// Autofills the selected item in the member listbox, by
/// taking everything before and after the "." in the richtextbox,
/// and appending the word in the middle.
///
private void selectItem()
{
if ( this.wordMatched )
{
int selstart = this.richTextBox1.SelectionStart;
int prefixend = this.richTextBox1.SelectionStart - typed.Length;
int suffixstart = this.richTextBox1.SelectionStart + typed.Length;
if ( suffixstart >= this.richTextBox1.Text.Length )
{
suffixstart = this.richTextBox1.Text.Length;
}
string prefix = this.richTextBox1.Text.Substring(0,prefixend);
string fill = this.listBoxAutoComplete.SelectedItem.ToString();
string suffix = this.richTextBox1.Text.Substring(suffixstart,this.richTextBox1.Text.Length - suffixstart);
this.richTextBox1.Text = prefix + fill + suffix;
this.richTextBox1.SelectionStart = prefix.Length + fill.Length;
}
}
///
/// Searches backwards from the current caret position, until
/// a space or newline is found.
///
/// <returns>The previous word from the carret position
private string getLastWord()
{
string word = "";
int pos = this.richTextBox1.SelectionStart;
if ( pos > 1 )
{
string tmp = "";
char f = new char();
while ( f != ' ' && f != 10 && pos > 0 )
{
pos--;
tmp = this.richTextBox1.Text.Substring(pos,1);
f = (char) tmp[0];
word += f;
}
char[] ca = word.ToCharArray();
Array.Reverse( ca );
word = new String( ca );
}
return word.Trim();
}
#endregion
private void FormMain_Load(object sender, EventArgs e)
{
readAssembly();
}
}
Raja
|
|
|
|
|
what`s wrong with this?
i got an error.
Error 1 Missing partial modifier on declaration of type 'Chat.chatc'; another partial declaration of this type exists
namespace Chat
{
//public partial class chatc : Form
class chatc
{
private static Form myForm;
static Sys.Sockets.TcpClient myTCP;
[DllImport("kernel32.dll")]
private static extern void ExitProcess(int a);
public static void Main()
{
thanks.
to know everything is to know yourself...
|
|
|
|
|
chatc is a form, and therefore the framework creates two files for it, one that contains the designer stuff and one for your code. You commented out the class definition and inserted your own ( which contains an instance of Form for some unknown reason ), but the other class still exists, and so that is the reason for the error. You have two files that reference the class chatc, and only one says it's a partial class.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thanks so much. i resolve that error. i forgot that i comment out that one. but after i compile another error appear.
Error 2 Program 'C:\Documents and Settings\...\obj\Debug\Chat_client.exe' has more than one entry point defined: 'Chat.chatc.Main()'
i just
namespace Chat
{
public partial class chatc : Form
// class chatc
{
private static Form myForm;
static Sys.Sockets.TcpClient myTCP;
[DllImport("kernel32.dll")]
private static extern void ExitProcess(int a);
public static void Main()
to know everything is to know yourself...
|
|
|
|
|
C#Coudou wrote: public static void Main()
I means that you have more than one of these.
|
|
|
|
|
|
|
Hello
I want to send folder to multiple users at a single time within a network.
Reply me.
Thanks
Devesh Mishra
|
|
|
|
|
Are you intending to look at on-the-fly zip-and-email?
|
|
|
|
|
No no sir. I am saying about only folder, not about the email.
C, i can send folder using 2 ways..Either using Zip folder or without zip. So which one will be much more efficient and how can i follow that ??
Thanks
Devesh Mishra
|
|
|
|
|
It depends on the number of files in the folder, and the network speed. Also, if the files are all compressed (jpgs for example ), they won't get any smaller, so you get no speed advantange, but you pay the time cost of compressing into a zip still.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
So according to you which option i have to follow.
1. using Zip
2. Without Zip
And also tell me how can i follow these option to get my target ....
Thanks
Devesh Mishra
|
|
|
|
|
Like I said, it really depends on what sort of files you want to send.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
This is going in circles. And I'm sure we had a similar discussion yesterday.
How do you mean "send folder"? What do you mean by that?
In a zip you are sending a file? But you have not explained adequately what you mean by that either.
You also say you want to sent it to "users". But you can't "send a folder" to a user. You can only copy or move a folder into another folder.
|
|
|
|
|
Sir,
I want to send folder by any means(Zip or without Zip). Not talking about the files.
Thanks
Devesh Mishra
|
|
|
|
|
devesh_code wrote: I want to send folder by any means(Zip or without Zip). Not talking about the files.
Stop repeating the same thing. It is obvious that people don't understand enough what you are asking. Try asking in a different way. Try explaining what you mean.
Try giving us the Big Picture. What is the overall scenario? Don't just give a little bit of the scenario because often you will find that there are some extremely intelligent people here that will be able to tell you a much more efficient way of completing the overall task rather than a small part of it.
|
|
|
|
|
are u talking about sending a folder containing files (Duh) across the network to many users on the LAN?
|
|
|
|
|
Don't ask me. As the original poster!
|
|
|
|
|
Watching this thread from outside is very funny. (Of course it's not your fault)
Looking forward for some more episodes!
|
|
|
|
|
Then all you need to do is send the name of the folder, and create it on the new machine. An empty folder cannot be sent, except in a zip, and it's a dumb thing to do.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi
If we send the name of the folder and create it on the new machine, then it'll be typical in case of folders inside a folder. Because i don't know the number of folders insisde a single folder.
By the way, I don't want to send empty folder. i want to send a folder and the folder must contain few files and few more folders.
Thanks
Devesh Mishra
|
|
|
|
|
what is the use of sending an empty folder ??
|
|
|
|