|
"Pay no attention to that man behind the curtain."
|
|
|
|
|
Hi.
I created one custom control which derives from Control class, and I noticed that my control doesn't have location property. How can I add that property? So, when I change that property, control will move to knew location. Problem is I don't know how to get a location of a control in parent control from parent control...
|
|
|
|
|
Hmm, about what kind of control are we talking here? Windows Forms or ASP.Net? Or in other words: Does your control inherit from System.Web.UI.Control or from System.Windows.Forms.Control? In case of an ASP.Net control this would actually not be much of a surprise.
|
|
|
|
|
Hello guys,
I am developing a small application for a small shop and this application requires a small database to store the information. Now I thought that I could work with an mdf file as I think there is no need to install databases like mysql or sqlserver 2005, SLQEXPRESS would meet all the needs. Now my questions is what security measures must I take to make sure that the data isn't compromised. Should I store the mdf file somewhere special when the application is installing? Should the connection string be stored in some special way? And does .mdf files allow you to create users like in SQLServer 2005 (Stupid question I think but asking anyway hehe)
Thank you guys for your help in advance.
Regards,
Christian Pace
few
|
|
|
|
|
Hi All ...
I Have A Problem In Crystal Report
It's Apper blank Page betwwen 2 page
How I Can Solve This Problem ??
thanks
Thaer
|
|
|
|
|
I build an application using Zedgraph and it seem to work fine. I compile and take the exe.file outside the folder containing the Zedgraph dll.
Then the application crashes because it "cannot find Zedgraph". Someting wrong with "Assembly binding". What to do?
|
|
|
|
|
Um.... perhaps some common sense is needed here. Zedgraph is in the dll. You take the exe and put it in a folder without the dll, and zedgraph is not present. Surely that's pretty obvious ? The only solution is to move all the zedgraph code into your app, assuming the license allows you to do that, or to distribute it with the dll.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian is right about moving the zedgraph.dll into your application directory, we have done that where I work. You must acknowledge it in your application though.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
How does one move the zedgraph.dll into the app? I've looked everywhere and your post is the closest I've come to finding out how. Thanks!
|
|
|
|
|
Hi
when I send 1000 byte with socket.send , I always recieve 1000 byte with socket.recieve.
I know it shouldn't be true for general but because 1000 bytes is a small amount can we be sure that it will not fragmented?
I tested it in visual studio and until 8KB every amount I sent, I got exactly the same amount and after that it didn't;
if enough data are provided is there a minimum amount on socket.available. for example because of packet size. I have heard that minimum packet size is 64, and default MTU(maximum transmit unit) in XP is 1500 bytes.
I use TCP and ethernet and actually the answer is very critical to me.
Thanks
|
|
|
|
|
Hi
I am developing FTP Clinet application that downloads files from the specified server
i sent the LIST command and server returned a list of file names in following order:
-rw-r--r-- 1 devubas devubas 24 Sep 5 2008 .bash_logout
now the problem is how do i extract the filename fom above string for example just the .bash_logout.
Is there any way to just get the filename from FTP server by sending this command combined with other parameters.
Please help
|
|
|
|
|
Hi all, I am trying to populate a treeview from a webservice through a thread and get an invoke error when I call the function in the thread - outside the thread it works perfectly - but is too slow to be used outside a thread.
So wondered if there were anyone who have some experience on Invoking in treeviews?
my code is as follows:
private void ThreadingGroups()
{
Thread TsGroups = new Thread(ThreadGroups);
TsGroups.Start();
}
private void ThreadGroups()
{
DataTable dt = DOCTemp.GetGroups();
DataRow dr = dt.NewRow();
dr[0] = "";
dr[1] = "Default";
dt.Rows.InsertAt(dr, 0);
frmTemplateManager.treeView1.Nodes.Clear();
for (int i = 0; i < dt.Rows.Count; i++)
{
TemplateManagerTreeView(dt.Rows[i]["id"].ToString(), dt.Rows[i]["name"].ToString());
}
}
private void TemplateManagerTreeView(string id, string name)
{
frmTemplateManager.treeView1.Nodes.Add(id.ToString(), name.ToString());
}
The function is basically updating a treeview located in form named frmTemplateManager and it iself it works quite well. Just need to find a way to get the Invoke to work in a way..
Cheers,
modified on Sunday, October 25, 2009 3:17 AM
|
|
|
|
|
btw I did have a look at the article "Populating TreeView on a Background Thread" but didnt give me any clues on how i got out of my error.
|
|
|
|
|
As you have found out, you must always use a UI control on the main thread. So you will have to marshal the treeView1.Nodes.Add calls on to the main thread using Invoke or BeginInvoke .
What's taking the time - is it DOCTemp.GetGroups() or the loop round TemplateManagerTreeView ?
If it's the GetGroups call, then you can just marshal the whole loop in one go. If it's actually adding the nodes, you will have to split the loop up into chunks and marshal them one after the other. Invoking every TemplateManagerTreeView call individually would be slow.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Well it do take some time for the Webservice to finish. Especially when my server is located in California and some users will access this application in New Zealand - and that can be far, far, far away when im messing around with applications that don't play well with latency.
I am not asking you to do the code for me, but do you have some examples on how to marshal the loop when using the Invoke or BeginInvoke?
Cheers,
Ronni
|
|
|
|
|
This is an example for WinForms. WPF is similar, but uses the Dispatcher class.
private void UpdateTreeView( DataTable dt )
{
for ( int i = 0 ; i < dt.Rows.Count ; i++ )
{
TemplateManagerTreeView(dt.Rows[i]["id"].ToString(), dt.Rows[i]["name"].ToString());
}
}
Then in ThreadGroups() put:
frmTemplateManager.treeView1.Invoke( ( Action<DataTable> ) UpdateTreeView, dt );
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Man, so simple and yet so beautiful...
Thanks buddy.
Btw. implemented it but found out that when running it in a thread it gets added trice. Running it outside the thread will only added to the treeview once as it should.
Been going over the code but couldnt really see anything that should trigger the thread 3 times, so wondered if that had something to do with the invoke function?
|
|
|
|
|
I would suggest you read this[^].
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Thanks!, will read it. Can see that the more I get to know about C#, the more I have to read up on. *Damn*.

|
|
|
|
|
How can i run the open and save file codes in C# ???
modified on Sunday, October 25, 2009 2:07 AM
|
|
|
|
|
Not sure what you want: is it "how do I use the open and save dialogs in c#"? If so, then look at OpenFileDialog[^] and SaveFileDialog[^]
If not, then we need more information.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi
i want to display hierarchical data in treeView, for example i have a recursive query which get employees and his/her manager in northwind database like this :
WITH cte1 (LastName, EmployeeID, Manager, ManagerID, Level)
AS
(
SELECT e1.lastName, e1.employeeID, e2.LastName, e1.ReportsTo, 0
FROM Employees e1 LEFT JOIN employees e2 on e1.ReportsTo = e2.EmployeeID
WHERE e1.ReportsTo IS NULL
UNION ALL
SELECT e1.lastName, e1.employeeID, c.LastName, e1.ReportsTo, Level + 1
FROM Employees e1 JOIN cte1 c ON e1.ReportsTo = c.EmployeeID
)
SELECT * FROM cte1
now, i want to display this result set to treeview in hierarchical mode, but i don't know how to do this. can anybody provide source code ?
thanks
|
|
|
|
|
Consider the following...
struct Node
{
unsafe { public Node* parentNode; }
public int someData;
}
class SomeClass
{
Node[] nodeArray = new Node[2];
Node[] otherNodeArray = new Node[1];
void LinkEmUp()
{
unsafe
{
nodeArray[0].parentNode = &nodeArray[1];
otherNodeArray[0].parentNode = &nodeArray[0];
}
}
}
And to add, lets say that an instance of SomeClass has a Node array where an element's parentNode points to a Node in another SomeClass instance's array.
Would the pointer chain will be intact after a garbage collection or after the CLR does something to change the reference types memory locations? Is it even possible to make linked lists and reference/pointer chains with .NET value types?
EDIT:
I figured it out. In the example above, the consumer of SomeClass would have to use the fixed statement to fix SomeClass and the two Node arrays. The Node arrays would also have to be made public so that the consumer can directly access them.
class SomeClass
{
public Node[] nodeArray = new Node[2];
public Node[] otherNodeArray = new Node[1];
public void LinkEmUp()
{
unsafe
{
nodeArray[0].parentNode = &nodeArray[1];
otherNodeArray[0].parentNode = &nodeArray[0];
}
}
}
Consumer
unsafe static void Main()
{
SomeClass c = new SomeClass();
fixed(Node* _temp = &c.nodeArray[0], __temp = &c.otherNodeAray[0])
{
c.LinkEmUp();
...
}
}
As far as my question about linked lists with C style structs, its possible if I use native API or Marshaling to allocate memory.
Another way is stack based linked lists built through recursion which I don't understand how it could be of any use that way.
modified on Saturday, October 24, 2009 11:28 PM
|
|
|
|
|
CaptainSeeSharp wrote: Would the pointer chain will be intact after a garbage collection or after the CLR does something to change the reference types memory locations? Is it even possible to make linked lists and reference/pointer chains with .NET value types?
The problem you have is that it points to a memory address that has been GCed. I'm unsure how the pointer chain would stay intact as .NET moves things around in memory, but I am certain that, just like C++, once you clean up a node, your chain is broken.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
What I really want to know is if it is possible to create a linked list in .NET using a valuetype Node that uses a pointer to point to other valuetype Nodes. If it is possible, I would like to see a small example.
|
|
|
|