|
u will need to clear the tree view each time u change the view type
and save all item in a hashtables that has
hastable 1 view type 1
[key = subitem ,value array list of ref to items ]
and :
hastable 2 view type 2
[key = item ,value array list of ref to subitems ]
this is called mirroring
and then re insert them your self using those hastables
Have Fun
Never forget it
|
|
|
|
|
I see.
How about using a dataset or a datatable instead?
Thanks
|
|
|
|
|
u can but why?
hashtable gives u the ultimate key to value without "asking"
the datatable inside a dataset to give u information
here u just get the value u want from the hashtable Like :
hastable[key] and that it
where in a datatable u need to u use the select method
hastable are designed to be fast and one way in purpose
Have Fun
Never forget it
|
|
|
|
|
In that case, would a generic collection be a good decision for this purpose?
Thanks
|
|
|
|
|
|
Hi guys,
I'm trying to do a very simple project where I can turn a light on and off via a software component. For example, when a mail message is received in a critical queue a light mounted on the ceiling blinks on and off in a certain pattern.
It sounds so easy but I have no idea where to start. I'm not sure how I can connect a tangible object with physical mass (Light fixture) to a logical object such as software (PC).
Can anyone recommend a kit or something like that where I could have a USB or Serial port connected to a circuit board which then in turn connects to a light switch or something to that effect?
I think codeproject has some articles on how to talk to a serial port in c#.
Thanks
|
|
|
|
|
|
|
Since most PCs nowadays don't have a parallel port any more, it may be useful to know
you can do similar things with a serial port; on a typical DB9 connector there are
some 5 so called control lines; some are inputs to the PC, others are outputs.
And you can observe the inputs and control the outputs using the SerialPort class,
once you have opened the appropriate port.
You will find several relevant articles on CP about this.
BTW: if you are not really familiar with electronics, I strongly recommend you
experiment with a USB-to-serial cable; that way, when you damage the goods, it is
just that cable that has to be replaced, not your I/O card or mother board.
|
|
|
|
|
Ah.. great advise. Any chance there is an aftermarket kit that I could purchase on the hardware side that could demonstrate how this 120v lamp connects to a circuit board and then from the circuit board to the serial/parallel/usb port on the PC?
|
|
|
|
|
Hi,
don't know what is available in your area.
the link Alex provided also has "high voltage" stuff, things that would control
120/230V equipment.
DIY stuff would be cheaper, provided you get it right from the beginning...
|
|
|
|
|
For USB based control and measurement of external devices I'm a big fan of the miniLAB 1008[^]
2 10 bit analog outputs
4 12 bit analog inputs or 8 11 bit single ended
28 dio
Slight overkill for just turning one device on and off (for which you would need to use the miniLAB to switch a relay), but should you progress to analog contol and measurement or decide to control several devices it's pretty cheap and very easy to set up and use.
No doubt there are loads of other similar bits of kit - I've just had a lot of success with these.
|
|
|
|
|
Hallo to all.
Does somebody know how to remove a AddIn from VStudio 2008?
I already deinstalled the AddIn from Windows, but there are still some menu-entries in VStudio 2008
Kind regards
|
|
|
|
|
Go to the "My Documents\Visual Studio 2008\Addins" directory, and remove anything related to the add-in from there.
|
|
|
|
|
Hello.
I have a weird problem. I'm using 2 applications (Client and Server). Both are connected using remoting. Somehow, I got a problem, if I say connect to server, I got an exception :
"The input stream is not a valid format. 3C-22-....".. something like that.
(I'm using username : userA)
BUT, if I logout from windows and login again using another username (userB), it works.
Both users are Administrator.
If I delete userA, then create it again, it works....
Does anybody knows, what's wrong with remoting or user problem ??
Thx...
|
|
|
|
|
Alright, I have a log console that i have created that is specific for my multi-form application. It is a grid view with methods to write to that grid view, in the event of an Exception, it will take that information then write it to the system log. But, my concept is to have the log console instantiated from the beginning and just toggling the visibility of the form.
I've been playing around and reading on the internet different ways to do what i am looking on doing but have not had much luck being able to access that specific method LogConsole.WriteLine(string) other than where it has been instantiated.
This would be more of debugging console kinda of, but is ment for the IT people with in my company to be able to pin-point future issues, the log will display, errors, informational sql connection information, etc, etc.
Any suggestions to put me in the right direction?
|
|
|
|
|
Have you considered creating a form that would always be on top in your main method? Creating it from the start, then all the other windows would be under your control as well but would be fired up after the creation of your logging form.
This is assuming that I've understood your problem correctly.
|
|
|
|
|
Here's one way, create a test project with:-
2 Forms (Form1 and DebugWindow)
1 "Logger" class.
Form1 just has 2 buttons on it, 1 to write an entry to the "Logger" class,
the other to "Show" the Debug form.
The DebugWindow form just has a Listbox on it.
The Logger class has a static method which can be called from any class in your project,
which in turn writes an entry in your DebugWindow listbox.
Here's the Form1 class.
<<<
public partial class Form1 : Form
{
DebugWindow dbug;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
dbug = new DebugWindow();
dbug.Show();
Logger.DebugWindow = dbug.DebugListBox;
}
private void button1_Click(object sender, EventArgs e)
{
Logger.LogIt(DateTime.Now.ToString("dd MM yyyy HH:mm:ss.fff"));
}
private void button2_Click(object sender, EventArgs e)
{
dbug.Show();
}
}
>>>
Here's the DebugWindow class.
<<<
public partial class DebugWindow : Form
{
private ListBox _debugListbox;
public DebugWindow()
{
InitializeComponent();
}
//
// hide form
//
private void hideToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Hide();
}
//
// Properties
//
public ListBox DebugListBox
{
get { return _debugListbox; }
set { _debugListbox = value; }
}
private void DebugWindow_Load(object sender, EventArgs e)
{
DebugListBox = listBox1;
}
}
>>>
Here's the Logger class.
<<<
class Logger
{
private static ListBox _debugWindow;
//
// Log Message
//
public static void LogIt(string sData)
{
sData = sData.Trim();
UpdateListBox(sData);
}
//
// output to listbox
//
delegate void ListBoxStringAdder(string sInfp);
private static void UpdateListBox(string sInfo)
{
int iLines = 999;
if (DebugWindow.InvokeRequired)
{
ListBoxStringAdder lsa = new ListBoxStringAdder(UpdateListBox);
DebugWindow.Invoke(lsa, new object[] { sInfo });
}
else
{
if (DebugWindow.Items.Count == iLines)
{
DebugWindow.Items.RemoveAt(iLines - 1);
DebugWindow.Items.Insert(0, DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss.fff") + " | " + sInfo);
DebugWindow.SelectedIndex = 0;
}
else
{
DebugWindow.Items.Insert(0, DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss.fff") + " | " + sInfo);
DebugWindow.SelectedIndex = 0;
}
}
}
//
// Properties
//
public static ListBox DebugWindow
{
get { return _debugWindow; }
set { _debugWindow = value; }
}
}
>>>
|
|
|
|
|
Hi, I am a VB.NET programmer trying to get to grips with C# and it seems as far as I can see that events in VB are very different in C#
I have this in VB:
Public Class CGeneralParameters
Implements IDisposable
Public Event ClassError(ByVal e As ClassErrorData, ByVal CriticalError As Boolean, ByVal MustDisplay As Boolean)
Private m_strConnectionString As String = ""
Private m_sAppData As String = ""
Private e As ClassErrorData
The code translator has done this to it:
<pre>public class CGeneralParameters : IDisposable
{
<big>private ClassErrorData e;</big>
private bool CriticalError;
private bool MustDisplay;
private string m_strConnectionString = "";
private string m_sAppData = "";
<big>private ClassErrorData e;</big>
public CGeneralParameters()
{
and has pushed the structure to the end of the class.
Can I use events in this DLL to pass errors back to the calling program, or shouyld I be looking at another way to do this?
|
|
|
|
|
Generally, code translators are not the best at converting code from one language to another. There will be something missing.
From what you've posted, I can't really see where the problem is. Event declaration in a class is not important, assigning it (aka wiring) is. And yes, any exceptions thrown by a dll method that has been called by your application will be captured in the calling method as long as it is not being handled in that method.
|
|
|
|
|
Use a different converter - this code is very simple to convert.
In VB, you can specify an event combined with an implicit delegate.
The conversion to C# (via Instant C#) is:
public delegate void ClassErrorEventHandler(ClassErrorData e, bool CriticalError, bool MustDisplay);
public event ClassErrorEventHandler ClassError;
(the formerly implicit delegate has been named 'ClassErrorEventHandler' in the conversion).
David Anton
http://www.tangiblesoftwaresolutions.com
C++ to C# Converter
C++ to VB Converter
C++ to Java Converter
VB & C# to Java Converter
Java to VB & C# Converter
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: convert VB, C#, or Java to C++/CLI
|
|
|
|
|
Is there a way to (check/scan through network) ip addresses of listening ports in a network
|
|
|
|
|
Probably you have to connect to it, if you get an exception -> port closed, otherwise successfull, then close it.
|
|
|
|
|
If you put the server listining you will(or not) accept clients and by that get their ip.
Having the ip´s send whatever package you want to.
I assume that you didn´t start yet. Download some application here and see the code, if you have doubts ask here then.
|
|
|
|
|
I am new to .NET interoperability. I need to write some C++ code which would access the methods of a .NET component. Any help is greatly appreciated.
Regards,
|
|
|
|