|
Paul Watson wrote:
Being in overkill mode I think I will subclass the TreeView a bit and add in an overriden AddRange method which can handle just a simple array of string objects. I for one do not always need all the fancy properties of a TreeNode.
I would just make a static funtion
static TreeNodeCollection MakeNodes(string[] names)
{
TreeNodeCollection nodes = new TreeNodeCollection();
foreach (string name in names)
{
nodes.Add(name);
}
return nodes;
}
or
static void AddNodes(TreeNode parent, string[] names)
{
foreach (string name in names)
{
parent.Nodes.Add(name);
}
}
Overriden...derived classes...why?
DBHelper - SQL Stored Procedure Wrapper & Typed DataSet Generator for .NET
|
|
|
|
|
leppie wrote:
Overriden...derived classes...why?
I did mention I was in an overkill mood...
Also this kind of thing is something I will probably want to use over and over, makes it easier and more consistent if I have a TreeView control I can just drag on that already has it built in.
Thanks for the code.
Paul Watson Bluegrass Cape Town, South Africa Christopher Duncan wrote:
Which explains why when Santa asked, "And what do you want for Christmas, little boy?" I said, "A life." (Accesories sold separately)
|
|
|
|
|
James T. Johnson wrote:
(ie use a blasted for loop; or foreach)
Were you upset James, your too funny sometimes.
Nick Parker
Not everything that can be counted counts, and not everything that counts can be counted. - Albert Einstein
|
|
|
|
|
Nick Parker wrote:
Were you upset James
Nope, just repeating what Paul said
James
- out of order -
|
|
|
|
|
Hello,
how to overide the OpenDialog or SaveDialog box, like in VisualStudio Net.
// Maybe drawn all the box ?
Thanks in advance
|
|
|
|
|
Hello,
How to draw one control bar (where is controlbox) ownerdraw ?
Thanks.
|
|
|
|
|
You may want to check out Lutz Roeder's Command Bar[^] That's:
A)Really cool
B)A good example of owner-drawing, and
C)Made by the same guy who made Reflector. I'd also check out that tool if you're going to be doing any serious .NET development. It's way better than the VS.NET object browser.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
Hi All
I have created a new c# dll and want to use that in VB6. When I add a reference to the dll in vb, it throws an error "Cant add reference to dll".
Any help
$iva
|
|
|
|
|
Take a look at the help topics under "Exposing .NET Framework Components to COM". I think that will cover what you need.
Burt Harris
|
|
|
|
|
Burt Harris (msft) wrote:
Take a look at the help topics under "Exposing .NET Framework Components to COM".
MSDN Article link[^]
Nick Parker
Not everything that can be counted counts, and not everything that counts can be counted. - Albert Einstein
|
|
|
|
|
You didn't create a DLL, you created an assembly. You cvan't use asseblies in VB6.
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Hi,
It is possible to use .net assemblies in VB6 using Interop.
You need to run regasm tool with /tlb or /codebase option, so that it creates a wrapper for the .net assemblies to be called from COM.
Alternately you can directly reference MSCorLib / MSCorRe from VB6 and create instances of framework components(like HashTable or any other class). I dont have the sample with me right now, but DonBox demonstrated this sometime back in TechEd.
regards
Kannan
|
|
|
|
|
Ooh!
Cool!
But does the .NET redistributable have to be installed on my customers computer??
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Rickard Andersson wrote:
But does the .NET redistributable have to be installed on my customers computer??
Absolutely, its just a wrapper that is generated by the regasm dll, something like a proxy. The runtime kicks in once you start calling managed methods.
Cheers
Kannan
|
|
|
|
|
Kannan Kalyanaraman wrote:
something like a proxy
<changed_subject>
Could you tell me where I could learn more about what a proxy is and how it works etc.?
I want to learn...
</changed_subject>
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Well, I'm no expert here, but I can't recollect any specific resources as to deal with proxy/stub (in COM world).
You can refer to Don Box's Essential COM or Inside COM / DCOM for a thorough treatment on the subject.
In simpler terms Proxy might refer to a piece of code which helps to communicate between the provider / consumer.
I hope I'm not confusing you too much.
Cheers
Kannan
|
|
|
|
|
hi $iva,
You cannot add reference to the dll (assembly) you have created in .net 'cause its not a proper COM dll, if you have a closer look, you can see that .net assembly doesnt have any COM specific mechanism to locate the particular DLL (there is no entry in the registry pointing to the location of the dll or does the other application know how to create an instance).
So, to call .net assembly from VB6 you need to do couple of things.
Create public interfaces and implement those interfaces in a class. Only public methods are visible to COM.
Run regasm tools against this assembly to make sure that other COM aware clients know how to create this COMponent and call those methods.
Refer msdn on Regasm and COM Interop.
Hope this helps.
Cheers
Kannan
|
|
|
|
|
i obtain a socket through TcpListener using:
Socket mySocket = myListener.AcceptSocket() ;//myListener is TcpListener
sometimes, i realize that my program will halt at line:
int i = mySocket.Receive(bReceive,bReceive.Length,0) ;
hence, i was thinking to set a receive timeout option, my questions is
(1)is this the correct method
mySocket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.ReceiveTimeout, 1000)
i put SocketOptionLevel as SocketOptionLevel.Tcp, is it correct?
(2)what will happen when the program come to line
int i = mySocket.Receive(bReceive,bReceive.Length,0) ;
and after 1000 miliseconds and still have not received anything. where will the program execution go?
thank you.
regards
yccheok
|
|
|
|
|
1) I'm using
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 60000);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 60000);
socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveBuffer, 1024);
socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1);
So I think it should be SocketOptionLevel.Socket. Found it elsewhere on google.
2) Set a breakpoint on that line and trace over it. It will either fire an exception or go to the next line. Don't quite remember. Check the return values for receive as well.
|
|
|
|
|
i try to run an console application through a programmatically created process. i dont want a new console command window to pop up during the process running. hence, i use the following code.
------
System.Diagnostics.ProcessStartInfo pi = new System.Diagnostics.ProcessStartInfo(Application.StartupPath+"\\EncodeFile.exe");
pi.CreateNoWindow = true;
p = new System.Diagnostics.Process();
p.StartInfo = pi;
p.Start();
------
however, the console command window still show up although i oledi set
pi.CreateNoWindow = true;
can anyone tell me the solution?
thank you.
regards
yccheok
|
|
|
|
|
try it with the compiler option /target:winexe
Cheers
Kannan
|
|
|
|
|
You need to set the RedirectStandardInput , RedirectStandardOutput and RedirectStandardError properties of the <EDIT>ProcessStartInfo </EDIT> object to true . If you need to, you can then access the input and output of the console using the StandardInput , StandardOutput and StandardError properties.
E.g.:
ProcessStartInfo psi = new ProcessStartInfo();
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.FileName = "Path to the exe";
Process p = Process.Start(psi);
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
<br />
((Rectangle)mySquares[i]).X = <br />
((Rectangle)mySquares[i-1]).X;
I have an ArrayList of Rectangles and would like to update the X co-ordinate with the old one but this assignment generates a compiler error "The left-hand side of an assignment must be a variable, property or indexer"
yet the left hand side of this IS a property. Is there a reason for this? do I have to extract/assign the x co-ordinates in a for loop?
|
|
|
|
|
If this is not already in a for loop, then how is the current value of i determined?
in any event, it will fail for i=0 since there is no element whose index = -1.
Perhaps we need a to see just a wee bit more of your code in order to help?;)
|
|
|
|
|
<br />
for (i = mySquares.Count - 1; i > 0; i--)<br />
{<br />
((Rectangle)mySquares[i]).X = <br />
((Rectangle)mySquares[i-1]).X;<br />
((Rectangle)mySquares[i]).Y = <br />
((Rectangle)mySquares[i-1]).Y;<br />
}<br />
I'm trying to update the x,y co-ordinates of the rectangles in the arrary in a Timer.Tic() method.
it tells me that my left operand has to be a property but is Rectangle.X not a property?
|
|
|
|