|
Thats the cool solution I think:->:->
Regards ,
nishu
|
|
|
|
|
How do I call a class Library(DLL) that I have created using Visual Studio 2005? I created the class library using Visula studio 2005. Thanks.
Peter Usinga
|
|
|
|
|
Hi,
If you created the DLL in C# you just have to add the DLL to the References of your project and then use the namespace which is contained in that DLL.
Hope it helps.
Do your best to be the best
|
|
|
|
|
Add a reference to the DLL in the project.
|
|
|
|
|
I have .NET 1 WinForms DataGrid bound to DataTable in C#
I need to change column order interactively, like dragging column
header to other place.
How to implement this ?
Andrus
|
|
|
|
|
I have .NET 1 WinForms DataGrid bound to DataTable in C#
When new line is added, first column must become active.
How to implement this ?
To reproduce:
1. Run the code
2. Enter data to second column
3. Press down arrow key
Observed:
Second column in active
Expected:
First column must be active
using System.Windows.Forms;
using System.Data;
static class Program {
static void Main() {
Application.Run(new Frm());
}
}
class Frm: Form {
public Frm() {
DataTable table = new DataTable();
DataColumn column1 = new DataColumn();
DataColumn column2 = new DataColumn();
DataGrid grid = new DataGrid();
table.Rows.Add();
grid.Dock = DockStyle.Fill;
table.Columns.Add(column1);
table.Columns.Add(column2);
Controls.Add(grid);
grid.SetDataBinding(table, "");
}
}
Andrus
|
|
|
|
|
Hi,
I am using winforms .net 2.0
It seems that the visualStyle does not have any effect on the controls looks.
for example a button looks as if you are using .net 1.0
Any thoughts please?
|
|
|
|
|
There are several ways to get there:
*
* 1.
* call Application.EnableVisualStyles(); just before
* Application.Run(f);
* disadvantages:
* - this method does not exist under .NET 1.0
* - this method has a bug, causing later some ShowDialogs to throw a
* SEHException
* e.g. when using a ContextMenu on a NotifyIcon
*
* 2.
* create a manifest file with a specific name (<myApp>.exe.manifest) and put it
* in the directory containing the exe file itself. The fixed content must be:
*
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<description>.NET control deployment tool</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
*
* 3.
* create an instance of a special class before creating any of the intended
* forms, as in:
*
using (new LP_EnableTheming(true)) {
myForm form=new myForm();
form.CreateControl(); // can be included in myForm constructor !
Application.Run(form);
}
*/
The special class is inspired on the article at http://www.codeproject.com/useritems/ThemingInScope.asp
Luc Pattyn
-- modified at 14:12 Wednesday 27th December, 2006
|
|
|
|
|
Luc Pattyn wrote: The above got dammaged (all less/greater than signs got interpreted; I need an
extra HTML command ?!)
You need to check "Ignore HTML tags in this message" to keep the board from eating them.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|
|
|
The visual style for all of the .NET frameworks is what the machine is currently using. With XP for example, their are 3 visual styles: luna, metallic, and homestead. All of the .NET frameworks (as long as the code or manifest files are provided in the application) will use the visual style specified. The main differences in the UI between .NET 1.1 and .NET 2.0 would have to be the new ToolStrip, MenuStrip, and ContextStrip which are still dependent on the visual style (if render property is system defined). The strips which have replaced the menus and toolbars of .NET 1.x have a newer appearance that can only be used on systems with the .NET 2.0 framework installed. This new appearance will help in giving your application an interface similar to that of Office 2000-2003.
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[ ^]
|
|
|
|
|
can anyone give me a link or source code of a simple text transfer from a pc to a phone or vica versa through a usb dongle.
Ashutosh
|
|
|
|
|
|
hi
i have a html table in my webpage that it's link to another page, i want when user mouse over on it,a context menu show user that select which page
want to view,but how to do ?(like menu)
thanks
|
|
|
|
|
Hi
How i get a multiline in datagrid
Karthik
|
|
|
|
|
Hello,
I am trying to capture changes in a logfile (which is outputed by an external executable) and show them on a text box. Because the logfile updates from time to time, I cannot simply do a while ((line = reader.ReadLine()) != null) . Any suggestions on how I can capture the changes in the log file? The assumption is that the log file will just keep appending text and never get deleted. Capturing the output will end when the external .exe ends (finishes running).
Please help.
Thanks!
~Rafferty
|
|
|
|
|
FileSystemWatcher may help.
Use FileSystemWatcher to watch for changes in a specified directory. You can watch for changes in files and subdirectories of the specified directory. You can create a component to watch files on a local computer, a network drive, or a remote computer.
|
|
|
|
|
I do something like that.
I keep track of the position of the last byte I read from the file.
On each cycle I:
open the file
seek to the last position
read to the end
save the new position
close the file
(This is done by a service that cycles every ten seconds and reads the log of a third-party application.)
You could also keep the file open:
open the file
while (someTest)
{
if ( filePosition < fileLength )
{
read to end
}
else
{
sleep
}
}
close the file
|
|
|
|
|
Interesting idea.
But isnt there some risk that, while your code reads the new data from
the tail of the file, the original program is unable to append to it ??
Luc Pattyn
|
|
|
|
|
Luc is right, I am getting an IOException when I open the log file using StreamReader because the external process is still appending to the log file. Any suggestions on how I can just read the file using read access which still allows other processes to write to it? I tried using FileStream but I just can't figure out how to use the Read(...) method, how do you convert byte[] to a string ?
Thank you for your help,
~Rafferty
|
|
|
|
|
Sorry, I actually meant the other risk, where the log producer might
be hampered by the log consumer doing its thing.
The log consumer can always react on an IOException and come back
later to retry, but the log producer (over which we may not have control)
should never be hampered by the log consumer(s) and I am not sure
that is the case in the proposed setup.
Luc Pattyn
|
|
|
|
|
oh.. yes that is the case, i do not have control on the log producer. Can you propose a solution on how i can read the log? Here is how I tried to do it but it stopped the log producer from executing (so I guess it was hampered as you just said).
<br />
using ( FileStream fileStream<br />
= new FileStream(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite ) )<br />
{<br />
fileStream.Seek(_logFileLastReadPosition, SeekOrigin.Begin);<br />
TextReader reader = new StreamReader(fileStream);<br />
<br />
string line;<br />
while ( (line = reader.ReadLine()) != null )<br />
{<br />
PerformOutputAppended(this, new OutputEventArgs(line));<br />
_logFileLastReadPosition += line.Length;<br />
}<br />
<br />
reader.Close();<br />
fileStream.Close();<br />
}<br />
the code above is executed during a FileSystemWatcher Changed event, e.FullPath contains the full path of the log file. PerformOutputAppended(...) is the method which appends the string into the UI textbox.
I'm not sure if i'm doing things correctly as I am not familiar with these kind of behavior.
Thanks for your help,
~Rafferty
|
|
|
|
|
Hi Rafferty,
I don't have a general solution available, so I did some experiments.
I have one process that periodically (100msec) writes a string to a file;
my writer code reopens the file for every write access
(with a single open, a reader would be unable to access the file at all):
private void output(string s) {
try {
StreamWriter sw=new StreamWriter(fileSpec, true);
sw.WriteLine(s);
sw.Close();
} catch (Exception exc) {
timelog(exc.Message);
}
}
I have another process that periodically (but at a lower frequency, 1sec) tries
to read one or more lines; the code is similar to yours.
(assume seek is zero and delay is false):
private void input() {
try {
StreamReader sr=new StreamReader(fileSpec);
sr.BaseStream.Position=seek;
if (delay) Thread.Sleep(1000);
while((string s=sr.ReadLine())!=null) {
log("line "+line+": "+s);
seek=sr.BaseStream.Position;
}
sr.Close();
} catch (Exception exc) {
timelog(exc.Message);
}
}
This duo typically behaves well, I guess because the reader is simple enough
so it can do its job without a task reschedule, so the writer never is active
while the reader has file access.
But when I set delay true (reader keeping file accessed while relinquishing CPU), the writer starts to fail with "cannot access file", exactly as I was expecting.
I am still looking for a general solution; so far I would say the reader should
collect new data and avoid operations that take time or may relinquish the CPU.
But if the OS, for whatever reason, interrupts the input method and reactivates
the writer, things will go wrong there.
Luc Pattyn
|
|
|
|
|
Hello Luc,
Thank you so much for your help. I was able to figure out what to do, the code I posted above was almost correct, I just forgot to set my processStartInfo.RedirectStandardOutput to false . Here's some fixes to the code I posted above:
<br />
using ( FileStream fileStream<br />
= new FileStream(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) )
{<br />
fileStream.Seek(_logFileLastReadPosition, SeekOrigin.Begin);<br />
<br />
TextReader reader = new StreamReader(fileStream);<br />
<br />
string line;<br />
while ( (line = reader.ReadLine()) != null )<br />
{<br />
PerformOutputAppended(this, new OutputEventArgs(line));<br />
}<br />
<br />
_logFileLastReadPosition = fileStream.Seek(0, SeekOrigin.End);<br />
<br />
reader.Close();<br />
fileStream.Close();<br />
}<br />
Comments/suggestions greatly appreciated. But this is already serving my needs.
Thanks again Luc!
~Rafferty
|
|
|
|
|
hi all,
I am trying to develop an application that contains a navigator panel. the panel is supposed to have a small size of width only 7 on the loading process.
when the mouse comes over the panel wich is this thin layer of width 7 the panel should grow to be in its normal size.
and when the mouse leaves the panel the panel should shrink again to be of width 7.
It is working very fine (using the mouse enter and mouse leave events) but only when the panel is empty and does not contin any button.
but when i fill it with buttons it is not working at all.
I think it is because when the button is added to the panel it takes part of the visible part of the panel so it will not through the events of mouse enter.
I tried to make the buttons' visible property to false when the panel is in the shrinking mode but this didn't give any result to.
i tried to work on the mouse enter and mouse leave events of the buttons and this didn't work too.
did anybody face a problem like this before.
if so plz give me a solution.
i will keep trying to work it out.
if i find the solution before u i will tell u about it.
thanks in advance,
|
|
|
|