|
Hi,
Well I am not able to find any such links, but probably you could try this given code which
implements sliding of panels. The basic implementation includes decreasing or increasing the
height of the panel on Timer tick.
For example: We have a Panel, Timer and a Button control. On button control we are closing and
opening the panel.
BEGIN CODE
<br />
bool close=false;<br />
<br />
private void timer1_Tick(object sender, EventArgs e)<br />
{<br />
if (close==false)<br />
{<br />
if (panel1.Height > 0)<br />
<br />
panel1.Height -= 10;<br />
<br />
else<br />
{<br />
timer1.Enabled = false;<br />
close = true;<br />
}<br />
}<br />
else<br />
{<br />
<br />
if (panel1.Height < 190)<br />
panel1.Height += 10;<br />
else<br />
{<br />
timer1.Enabled = false;<br />
close = false;<br />
}<br />
}<br />
<br />
} <br />
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
timer1.Enabled = true;<br />
} <br />
END CODE
I hope this will help.
Regards,
Allen
Allen Smith
ComponentOne LLC
www.componentone.com
|
|
|
|
|
|
Hi Guys,
I am trying to find a property or method in Microsoft.Office.Iterop.Excel which will help me make a decision whether an excel file (can be any version of excel) has got any VBA code or macro. Can anyone help me with this.
So far I have found the following property that deals only with excel 4.0 worksheets:
Excel4IntlMacroSheets 'Returns a Sheets collection that represents all the Microsoft Excel 4.0 international macro sheets in the specified workbook. '
Excel4MacroSheets 'Returns a Sheets collection that represents all the Microsoft Excel 4.0 macro sheets in the specified workbook. '
Any help will be appreciated.
Thanks
happy coding!
|
|
|
|
|
You might want to rephrase your question in such a way that it makes it clear that you are attempting to do this in a C# implementation(Assuming that you ARE in fact trying to do this in C#) If you are not doing this in C#, you probably want to repost this in the appropriate forum. People sometimes get kind of "touchy" in here.
"I need build Skynet. Plz send code"
|
|
|
|
|
Hi, i have a datagridview and have bounded my datasource. When the gridview is loaded, the column name follows the table attributes name.
example
catID desc catName
I want to rename the column to Cat ID, Description, Category Name
How do i do that?
|
|
|
|
|
I assume you are talking about the column headers in the datagrid.
you can use the column aliases to rename your columns before binding the datasource to the dataset in design mode.
if you already have a bounded datasource then You can rename the column headers of the datagrid by using the following sample code
MyDataGrid.Columns["catID"].HeaderText = "Cat ID";
MyDataGrid.Columns["desc"].HeaderText = "Description";
MyDataGrid.Columns[2].HeaderText = "Category Name";
|
|
|
|
|
why don´t you do it in sql???
|
|
|
|
|
|
I'm hoping someone can nudge my thoughts in the right direction here. I'm trying to implement a semi-advanced search function.
Basically, what I have is, a DataGridView and a TextBox . The
DataGridView<code> was populated manualy (ie. not databinded to a DB or something) and has two columns, one for Scientific Name and one for Common Name (I'm listing species of birds or fish or whatever in the grid).<br />
<br />
I would now like to have the user type any part of a name into the <code>TextBox and after every keypress the first row in the DataGridView that matches the text gets highlighted.
One (not so elegant) way of doing this would be to override the TextChanged event of the TextBox and do a foreach on all the rows in the DataGridView , looking for the entered text in each row and then highlighting it if a matchis found. The problem is that the grid can have several thousand entries and a foreach search might take much too long.
Any ideas will be appreciated.
|
|
|
|
|
ur scenario may be different, but, i used the following method in one of my application.
dgv refers to a DataGridView object
BindingSource bs = new BindingSource();
//u may create a custom data source and then populate it
bs.DataSource = YourDataSource;
dgv.DataSource = bs.DataSource;
bs.Position = bs.Find("PropertyToBeSearchedIn", "TextToBeSearched");
|
|
|
|
|
Dewald wrote: The problem is that the grid can have several thousand entries and a foreach search might take much too long.
Why do you think so? Have you tried it?
I have a project with a ListView showing an event log where I filter the rows. I changed the filter to look for part of a string (in a rather inefficient way; creating temporary strings for each item), but with 90000 items the time for searching them all is still hardly noticable.
Your only alternatives to looping the data when the user enters the string, is to do the searching beforehand by setting up some kind of tree, where you can find all items containing the character "a", then among those items all items that contain "ab", et.c. It would perhaps take a few seconds to search through all the data, but then it would be fast to find the items in the tree.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Intrigued by the idea of a search trea, I tried to build a simple class that does it:
public class SearchTree<T> {
private class UniqueList<Key> : IEnumerable<Key> {
private Dictionary<Key, byte> _list;
public UniqueList() {
_list = new Dictionary<Key, byte>();
}
public void Add(Key value) {
_list[value] = 1;
}
public Key[] ToArray() {
Key[] result = new Key[_list.Count];
int index = 0;
foreach (Key value in _list.Keys) {
result[index++] = value;
}
return result;
}
public IEnumerator<Key> GetEnumerator() {
return _list.Keys.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
return _list.Keys.GetEnumerator();
}
}
private class NodeList : Dictionary<char, SearchNode> {
public new SearchNode this[char c] {
get {
SearchNode node;
if (!this.TryGetValue(c, out node)) {
node = new SearchNode();
this.Add(c, node);
}
return node;
}
}
}
private class SearchNode : NodeList {
private UniqueList<T> _indexes;
public SearchNode() {
_indexes = new UniqueList<T>();
}
public void Add(string word, int pos, T index) {
_indexes.Add(index);
if (pos < word.Length) {
this[word[pos]].Add(word, pos + 1, index);
}
}
public T[] FindWord(string text) {
if (text.Length == 0) {
return _indexes.ToArray();
} else {
SearchNode node;
if (this.TryGetValue(text[0], out node)) {
return node.FindWord(text.Substring(1));
}
return null;
}
}
}
NodeList _nodes;
public SearchTree() {
_nodes = new NodeList();
}
public void AddWord(string word, T index) {
for (int i = 0; i < word.Length; i++) {
_nodes[word[i]].Add(word, i + 1, index);
}
}
public T[] FindWord(string text) {
if (text.Length > 0) {
return _nodes[text[0]].FindWord(text.Substring(1));
}
return null;
}
}
Creation of a search tree (from the string array lines ):
SearchTree<int> tree = new SearchTree<int>();
for (int i = 0; i < lines.Length; i++) {
foreach (string word in lines[i].Split(' ')) {
tree.AddWord(word, i);
}
}
Usage:
int[] result = tree.FindWord("a");
The result is an array of indexes for the lines where the words were found (or null if nothing was found).
I made some test data by copying text from some articles here, ending up with 3313 lines of text, 22248 words. Creating a tree from this takes around 260 ms on my computer, and searching the tree for a string like "win" gives a result of 31 lines and takes around 0.00076 ms.
The class is quite flexible, you can use most anything as index, you could even use the rows in a grid view: SearchTree<DataGridViewRow> . Searching that tree would give you an array containing the rows where the words were found.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Bookmarked for further use (I can think of plenty of applications) - 5 from me
You should make this into an article.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Excellent idea and thanks for the post. I will definitely try this out in some other projects as well.
As a matter of interest, you were quite right in your original post that an exhaustive search (with something like foreach) really doesn't take as much time as one would have thought. I'm amazed at how quickly it runs through 9000 entries.
Thanks again.
|
|
|
|
|
Why not with a db??? that´s not hard at all, and easier!
Create a textbox_textchanged event and trigger a store procedure from there!!!
I already done it, but with help of a db.
|
|
|
|
|
Hi
I want to write a windows application that doesn’t have a form, that is no input or output.
I have tried the console project but that causes a CMD box to flash up, I have tried the windows service option but this doesn’t allow it to be run from the command line.
This is what I want to do:
My application will be launched from a function key in our main application (uses Shellexecute) it then checks some items and launches another existing application.
no user interaction is required.
|
|
|
|
|
use the "main" method
do not show any form (if u have any)
|
|
|
|
|
you can hide the form on start up
< note this will show the application in taskbar >
private void Form1_Load(object sender, System.EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
this.Visible = false;
}
Vikas Amin
UNITED STATES STEEL CORPORATION
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
If you want to hide the window
ShowInTaskbar = false;
Vikas Amin
UNITED STATES STEEL CORPORATION
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
Hi,
I am running a DOS command from my C# application using Process.Start(cmd, arg)
Does it a way to get the result of this command like "Timeout occurred", "File not found" etc...
Thanks.
|
|
|
|
|
If u just need to get an result from a Commnad (ie dir ) then
use ">" so the output wil be directed to text file
c:\ dir > c:\vikas.txt
A tool clip.exe from microsoft does the same and puts the data on the Windows clipboard.
you can also redirect your otput to screeen
stream = freopen("file.txt", "w", stdout)
http://support.microsoft.com/kb/58667[^]
Vikas Amin
UNITED STATES STEEL CORPORATION
My First Article on CP" Virtual Serial Port "[^]
modified on Monday, August 4, 2008 2:48 PM
|
|
|
|
|
you can do it like that:
Process p = new Process();
//Fill the StartInfo of the Process----"cmd.exe"
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;//important
p.StartInfo.RedirectStandardOutput = true;//important
p.StartInfo.RedirectStandardError = false;//true,the same...
p.StartInfo.CreateNoWindow = true;//important
string strResult;
p.Start();//start the process
//for example
p.StandardInput.WriteLine("ping www.google.com ");
p.StandardInput.WriteLine("exit");//important
strResult= p.StandardOutput.ReadToEnd();
// below...you want
if (strResult.IndexOf("( 0% loss )") != -1)
{
}
else
if (strResult.IndexOf("Destination host unreachable.") != -1)
{
}
else
if (strResult.IndexOf("Request timed out.") != -1)
{
}
else
if (strResult.IndexOf("Unknown host") != -1)
{
}
else
{
}
// if end
p.Close();//close the process
|
|
|
|
|
Hi,
Thanks for the answer, it's very good.
But I have a problem, the command that I am running is "tftp.exe..."
when the transfer is successful I got the whole answer using the ReadToEnd function but when there is no tftp or the file doesn't exist I get only my command that I have sent I would expect to see "Timeout" or "File not found" as I see when I run the same command on the cmd prompt. Any Idea?
Thanks.
|
|
|
|
|
I am using visual studio .net 2008 and developing a windows forms application.
I want to use databinding and keep the business/validation logic in a separate layer (other than presentation layer).
The validation may be performed in ColumnChanged event or RowChanged event(depending upon user preference) of the datatable of the dataset.
validation error message must be shown in a Message Box
if validation is performed in ColumnChanged event and there are validation errors then the focus should be set to the control that has the validation errors.
if validation is performed in RowChanged event (i.e. user hitting the save button) and there are validation errors, then the focus should be set to the control which comes first in the tab order and has validation errors.
Is there any way i can do it?
|
|
|
|
|
I m using Crystal REports in my project
i have made setup project. but after deploying project, when i m trying to see it's giving me runtime error as below :
I have added crystal report as prerequisites ans also added reports to the appliction folder..
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Exception: Load report failed. ---> System.Runtime.InteropServices.COMException (0x80004005): The system cannot find the path specified. at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
at DPRMS.ReportViewer.btnshow_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
DPRMS
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/MONARCH/dprmsSetupWizard/DPRMS.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
CrystalDecisions.Windows.Forms
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.Windows.Forms/10.2.3600.0__692fbea5521e1304/CrystalDecisions.Windows.Forms.dll
----------------------------------------
CrystalDecisions.Shared
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.Shared/10.2.3600.0__692fbea5521e1304/CrystalDecisions.Shared.dll
----------------------------------------
CrystalDecisions.ReportSource
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.ReportSource/10.2.3600.0__692fbea5521e1304/CrystalDecisions.ReportSource.dll
----------------------------------------
System.Web
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
CrystalDecisions.CrystalReports.Engine
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.CrystalReports.Engine/10.2.3600.0__692fbea5521e1304/CrystalDecisions.CrystalReports.Engine.dll
----------------------------------------
CrystalDecisions.ReportAppServer.CommLayer
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.CommLayer/10.2.3600.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.CommLayer.dll
----------------------------------------
CrystalDecisions.ReportAppServer.ClientDoc
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.ClientDoc/10.2.3600.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.ClientDoc.dll
----------------------------------------
CrystalDecisions.ReportAppServer.DataSetConversion
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.DataSetConversion/10.2.3600.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.DataSetConversion.dll
----------------------------------------
CrystalDecisions.ReportAppServer.DataDefModel
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.DataDefModel/10.2.3600.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.DataDefModel.dll
----------------------------------------
CrystalDecisions.ReportAppServer.Controllers
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.Controllers/10.2.3600.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.Controllers.dll
----------------------------------------
CrystalDecisions.ReportAppServer.CubeDefModel
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.CubeDefModel/10.2.3600.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.CubeDefModel.dll
----------------------------------------
CrystalDecisions.ReportAppServer.ReportDefModel
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.ReportAppServer.ReportDefModel/10.2.3600.0__692fbea5521e1304/CrystalDecisions.ReportAppServer.ReportDefModel.dll
----------------------------------------
CrystalDecisions.KeyCode
Assembly Version: 10.2.3600.0
Win32 Version: 10.2.51014.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/CrystalDecisions.KeyCode/10.2.3600.0__692fbea5521e1304/CrystalDecisions.KeyCode.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Is there any solution to this problem ??
Brijal Patel.
|
|
|
|