|
Or you can configure a merge mudule in your project installer. There, you can put a crystal serial number so that it'll work in your custumers' machine.
It worked to me some time ago. Do some kind of research about this subject. You've to download these merge modules.
Good luck kubben... :]
|
|
|
|
|
This c# coding is to do drag and drop and reorder in list view. In this coding it can only add string to it. How i am going to add item besides string so that i can do drag and drop to that item.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace TestDrag
{
///
/// Summary description for Form2.
///
public class Form2 : System.Windows.Forms.Form
{
private DragNDrop.DragAndDropListView listView1;
private DragNDrop.DragAndDropListView listView2;
private System.Windows.Forms.ImageList imageList1;
private System.ComponentModel.IContainer components;
public Form2()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
LoadInfo();
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form2));
this.listView1 = new DragNDrop.DragAndDropListView();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.bar = new System.Windows.Forms.ImageList(this.components);
this.listView2 = new DragNDrop.DragAndDropListView();
this.listView2.SuspendLayout();
this.SuspendLayout();
//
// listView1
//
this.listView1.AllowDrop = true;
this.listView1.AllowReorder = true;
this.listView1.LargeImageList = this.imageList1;
this.listView1.LineColor = System.Drawing.Color.Red;
this.listView1.Location = new System.Drawing.Point(8, 8);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(272, 96);
this.listView1.TabIndex = 0;
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(24, 24);
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// bar
//
this.bar.ImageSize = new System.Drawing.Size(100, 100);
this.bar.TransparentColor = System.Drawing.Color.Transparent;
//
// listView2
//
this.listView2.AllowDrop = true;
this.listView2.AllowReorder = true;
this.listView2.LargeImageList = this.imageList1;
this.listView2.LineColor = System.Drawing.Color.Red;
this.listView2.Location = new System.Drawing.Point(8, 112);
this.listView2.Name = "listView2";
this.listView2.Size = new System.Drawing.Size(272, 96);
this.listView2.TabIndex = 1;
//
// Form2
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 219);
this.Controls.Add(this.listView2);
this.Controls.Add(this.listView1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Form2";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Form2";
this.listView2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void LoadInfo()
{
listView1.Items.Add("Item 1-1","item1");
listView1.Items.Add("Item 1-2","item 2");
}
}
}
This coding will display string "item1" and "item2" which can be drag and drop. I want to add other than string so the drag and drop can also be done.
|
|
|
|
|
Hello,
I have noticed a particular behavior in a program I am developing. I am interested if anyone might have a solution in mind.
I've got a TabControl with 6 TabPages on it. Each TabPage has a DataGridView on it and when the user selects a row on one of these DataGridViews, my program responds in some way that isn't germane to the problem.
The desired behavior is that the user is always presented, when selecting a TabPage, with a DataGridView with all rows unselected. Here is a code snippet to illustrate what I currently do to accomplish this:
private void tabControlPageSelected(object sender, TabControlEventArgs e)<br />
{<br />
(e.TabPage.Controls[0] as DataGridView).ClearSelection();<br />
}<br />
The behavior that I see is that, despite explicitly calling DataGridView.ClearSelection() after the population of these DataGridViews and again in response to the Selected event using the code above, as I click through the tab pages, the first row of each is initially highlighted. Once I have navigated to a new tab page and navigate back to the previous one, the highlighting is gone, as desired.
Code to test if any rows are selected tells me that none are, and it appears that the highlighting is simply a cosmetic annoyance, but that annoyance is confusing to the user and my primary goal is to make the program intuitive and free from annoyances.
Any ideas?
Thanks much,
Matt
It isn't enough to do well in life.
One must do good when and where one can.
Otherwise, what's the point?
|
|
|
|
|
both of these ways are basically cheating (they still work), but maybe in the onLoad you could do a foreach statement that deselects everything, and if that doesn't work, you could try making a foreach that selects every tab page once before the form is actually shown. Sorry for a lack of a better answer.
|
|
|
|
|
Dear All,
Please help me in solving my problem.
I have a windows application called "CallProcess", in it I have two TextBoxes on the form. I also have a method called display(), In this method I am creating a File and writing the text entered in the textBox into the file. Following is the code snippet,
public void Display()
{
StreamWriter sw = new StreamWriter(@"c:\shutdown.txt", true);
sw.WriteLine(textBox1.Text);
sw.WriteLine(textBox2.Text);
sw.WriteLine("Data written after execution of textbox data");
sw.Close();
}
Now I want to access this method in other windows application, I am writing the following code snippet,
try
{
Process[] BPDProcesses = Process.GetProcessesByName "CallProcess");
foreach (Process BPDProcess in BPDProcesses)
{
Console.WriteLine(BPDProcess.HasExited.ToString());
string ModuleName = "CallProcess.exe";
string TypeName = "Form1";
string MethodName = "Display";
Assembly BPDAssembly = Assembly.LoadFrom BPDProcess.MainModule.FileName.ToString());
BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);
Module[] BPDModules = BPDAssembly.GetModules();
foreach (Module BPDModule in BPDModules)
{
if (BPDModule.Name == ModuleName)
{
Type[] BPDTypes = BPDModule.GetTypes();
foreach (Type BPDType in BPDTypes)
{
if (BPDType.Name == TypeName)
{
MethodInfo[] BPDMethodInfo = BPDType.GetMethods(flags);
foreach (MethodInfo BPDMethod in BPDMethodInfo)
{
if (BPDMethod.Name == MethodName)
{
try
{
Object obj = Activator.CreateInstance(BPDType);
Object response = BPDMethod.Invoke(obj, null);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
}
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
But here I am getting the new instance of the application, the textbox data is null, I want the same data which was entered in the previous application i,e in the textbox. The file should be created and the data from the textboxes should be saved in the file. But this is not happening.
Please help me.
Thanx in advance.
|
|
|
|
|
|
Hi
I have created a user control which contanins a checkedListBox control.Now i somtime wants check boxes in list and some time not.So i want to set any property which can hide/show checkboxes.
Any body have Idea how this can be done
|
|
|
|
|
You can make it in code, so when you need check boxes just make a control of kind CheckedListBox, otherwise make it a regular ListBox. (As CheckedListBox doesn't contain any property to hide the checkboxes).
Otherwise you may create a custom control of you own to do all that stuff.
|
|
|
|
|
In the past I've used the ListView control to do this very thing. There is a handy property there called "CheckBoxes" that when enabled shows check boxes per row entry. To disable the check boxes, just set the "CheckBoxes" property to false. Of course you will have to deal with re-draw issues.
Phil
|
|
|
|
|
Hi
Ive made a program in c# with VS2005, is it possible to make a release on my program with frameworks 1.1? If it is possible can someone please help me?
Andreas
|
|
|
|
|
wrote: Ive made a program in c# with VS2005, is it possible to make a release on my program with frameworks 1.1?
If you have not taken advantage of any of the new features then it would be possible to compile the program for .NET 1.1 - but not in VS2005 itself.
|
|
|
|
|
ok, thank u for the quick answer.
|
|
|
|
|
|
If you use SharpDevelop instead of VS 2005, you can target either v1.0, 1.1 or 2.0 of the .Net Framework or even Mono and Boo.
Best of all, it's an open source project for which you can download the source code.
Hope this helps.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
Thanks, im gonna try with SharpDevelop.
|
|
|
|
|
Visual Studio 2003 gives you the ability to target either 1.0 or 1.1 of the .NET framework. VS 2005 it is technically possible to target the 1.0/1.1 platform through XML settings, I have not been able to successfully accomplish this. You would have to use VS 2003 or previous to work with the specific framework.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I am creating a TreeView which lists all the directories and ".xls" in a given directory
I have created my own version of TreeView and TreeNode, just to allow my TreeNodes to have some extra information (path of the file or the directory)
The problem i am facing is once done the processing the Tree View does not show mw the nodes in the Tree. if i check the count it is OK (same no of files and directories i have) but they don't show up on thew form. So i am providing my code in a hope that some1 will have an idea what i am doing wrong.
The first part is the method that create the treeview(my version), and tries to copy the nodes from it to the TreeView (.net) .
private void createTree()
{
g_ReportsFolder = Directory.GetCurrentDirectory() + "\\Reports2";
ReportTree rtree = new ReportTree(g_ReportsFolder);
foreach (ReportNode rNode in rtree.Nodes)
{
this.tvReports2.Nodes.Add(rNode);
}
}
Note: If I use
this.tvReports2.Nodes.Add(rNode.Text);
instead of
this.tvReports2.Nodes.Add(rNode);
I can view the nodes in the treeview
This is the TreeView class that creates the list of nodes by using a recursive function createTree(DirectoryInfo p_Directory)
public class ReportTree : TreeView
{
private string ReportsFolder = "";
private DirectoryInfo Directory = null;
public ReportTree(string p_ReportsFolder)
{
ReportsFolder = p_ReportsFolder;
Directory = new DirectoryInfo(ReportsFolder);
createTree(Directory);
string s = this.Name;
}
private void createTree(DirectoryInfo p_Directory)
{
DirectoryInfo l_DirctoryInfo = null;
foreach (FileSystemInfo Report in p_Directory.GetFileSystemInfos())
{
if (isDirectory(Report))
{
createDirectoryNode(Report);
l_DirctoryInfo = new DirectoryInfo(Report.FullName);
createTree(l_DirctoryInfo);
}
else if (isXLSFile(Report))
{
createFileNode(Report);
}
else
{
continue;
}
}
}
private bool isDirectory(FileSystemInfo p_FSI)
{
if (p_FSI.Attributes == FileAttributes.Directory)
return true;
else
return false;
}
private bool isXLSFile(FileSystemInfo p_FSI)
{
if (p_FSI.Attributes == FileAttributes.Archive && p_FSI.Extension == ".xls")
return true;
else
return false;
}
private void createDirectoryNode(FileSystemInfo p_DirInfo)
{
string l_Text = p_DirInfo.Name;
string l_Name = p_DirInfo.Name.Replace(" ", "").Replace("'", "").Trim();
string l_Path = p_DirInfo.FullName;
this.Nodes.Add(new ReportNode(true, l_Name, l_Text, l_Path));
}
private void createFileNode(FileSystemInfo p_FileInfo)
{
string l_Text = p_FileInfo.Name.Remove(p_FileInfo.Name.IndexOf(".xls"));
string l_Name = l_Text.Replace(" ", "").Replace("'", "").Trim();
string l_Path = p_FileInfo.FullName;
this.Nodes.Add(new ReportNode(false, l_Name, l_Text, l_Path));
}
}
This is the class that is customization of the TreeNode. I used this to have Some Extra info like path of the file with the node
public class ReportNode : TreeNode
{
public bool isDirectory;
public string NodeName;
public string NodeText;
public string NodePath;
public ReportNode(bool p_isDirectory, string p_Name, string p_Text, string p_Path)
{
this.isDirectory = p_isDirectory;
this.NodeName = p_Name;
this.NodeText = p_Text;
this.NodePath = p_Path;
this.Text = this.NodeText;
this.Name = this.NodeName;
}
}
o O º(`'·.,(`'·., ☆,.·''),.·'')º O o°
»·'"`»* *☆ t4ure4n ☆* *«·'"`«
°o O º(,.·''(,.·'' ☆`'·.,)`'·.,)º O o°
|
|
|
|
|
The difference between the two overloads is that the string version creates a new node; whereas the node overload just adds it to the collection. You should be getting an ArgumentException that indicates you cannot add the node in more than one place.
The solution for you is to clone the node. You'll need to override the Clone method from the TreeNode base class and make sure your properties are copied.
I also have a design recommendation for you. The ReportTree is not necessary. It appears that all of your implementation is related to creation. That is, you're not really maintaining any state in it. The Builder[^] pattern would work well for you. You'd still want the concrete tree node you created.
|
|
|
|
|
Hi,
I am designing an editor in C#. for example in searching for a text(Find)
when the searching text is found it should be highlighted.One more think,
i want to implement line number functionality in my editor.i dont know how
to do .
Please if any one knows help me.
With Thanks
Sakthi
|
|
|
|
|
SakthiSurya wrote: when the searching text is found it should be highlighted
If you are using rich text editor, you can do it easily. This control having methods to get and set the selection. Try for some richtext documentations.
SakthiSurya wrote: i want to implement line number functionality in my editor
My idea is keep one listbox near to textbox. apply all the styles for the listbox., According to the changes in richtext editor create line numbers and add to listbox. Make use of threading for better performance.
|
|
|
|
|
Of course you could do this yourself, but why should you if there are already several(three at least) controls on CodeProject which do just what you want. I have tried several of them out, and I think that for speed and functionability, the one by Uri Guy is the best. Here is the article-> Syntax highlighting textbox written in C#
|
|
|
|
|
Hi,
I am a novice of .NET. I am planning to write an application in C#.NET which is meant to serve a purpose of like "post-it" which would certainly need to be memory resident without any main window. Can I achieve this using Windows Forms name space?
Thanks
urs truly,
Mutyala Rao,
096886303653
|
|
|
|
|
Why not just hide the application window?
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
May be yes. We can hide the application window and display the "notes" windows. but there should be one source i mean an icon upon which clicked, a context menu can be displayed to configure settings or close the application if needed. For this i think its needed to show an icon in the system tray.
How can we do this?
urs truly,
Mutyala Rao,
096886303653
|
|
|
|
|
can i bind the unbounded columns in a datagridview with the columns in a database table at run time
|
|
|
|