|
try the following solution:
set
treeview.selectedNode.text = richtextbox.text and
treeview.selectednode.tag = richtextbox.rtf
and retrieve
richtextbox.rtf = treeview.selectednode.tag
the hope dies at last
|
|
|
|
|
Thanks for the answer. Actually can you give me a method which will translate the Rtf formatted string to stadard text, as I am going to use the same on different controls, which are not having Rtf property with them.
I am looking for a method which can translate both ways, i.e. if I send Rtf then it should return Standard string and If I send Standard string it should send Rtf formatted string.
Thanks
|
|
|
|
|
I tried to construct my first web-control using vb. I named it CatTree and derived it from the TreeView out of Microsoft.Web.UI.WebControls. For Testing I make a vb web Testapplication. It runs fine. I can add my CatTree-Control to the Toolbar and can place it on the Web-Form.
Now I sent the control to my partner for further testing. Unfortunately he is a C# - fan und tried to use the control in a C# Web. It fails with:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0234: The type or namespace name 'CatTree' does not exist in the class or namespace 'CatTree.CatTree' (are you missing an assembly reference?)
Source Error:
Line 85:
Line 86: private System.Web.UI.Control __BuildControlCatTree2() {
Line 87: CatTree.CatTree __ctrl;
Line 88:
Line 89: #line 17 "c:\inetpub\wwwroot\TestWebControl_C\WebForm1.aspx"
Source File: c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\testwebcontrol_c\105dcde8\29beb7c7\ytfyaxo4.0.cs Line: 87
What goes wrong?
|
|
|
|
|
Hi, I had a problem with socket permission.
I have created a server that has leaves its port opened to clients and telnet applications.
Clients can run succesfully if they stay in the same machine (localhost). Telnet on local host to the server port can be connected too.
However, if I tried to connect to the server port from another machine in the intranet, I won't be able to connect.
I've tried many ways, I've set the trust region of intranet to full trust, I've made instances of SocketPermission:
SocketPermission mySocketPermission1 = new SocketPermission(PermissionState.Unrestricted);
SocketPermission mySocketPermission = new SocketPermission(NetworkAccess.Accept, TransportType.Tcp, "192.168.*.*", SocketPermission.AllPorts);
But, why can't remote clients (hyperterminals / telnet) connect?
For your information, I'm using asynchronous sockets for my server application. Is the problem related with the socket permission, or is there any other possible problems, i.e. wrong class library usage. Thanks.
|
|
|
|
|
Ran into this while trying to interoperate with an existing socket based server...
i need to construct a buffer that contains mixture of strings & ints - the shorts/ints are stored in network byte order. So, i came with the following P/Invoke declaration in C#.
<br />
#region P/Invoke stuff<br />
[DllImport("ws2_32.dll")]<br />
private static extern short htons(short value);<br />
<br />
[DllImport("ws2_32.dll")]<br />
private static extern long htonl(short long);<br />
#endregion<br />
Unfortunately, the compiler barfs - says "expected class, delegate, enum, interface or struct". It looks like it doesn't like the return value specified as short or int. They are blittable types & i'm not sure what it doesn't like about them. Any pointers? TIA
Chen Venkataraman
|
|
|
|
|
Sorry i had a typo... the code should have been
<br />
<br />
#region P/Invoke stuff<br />
[DllImport("ws2_32.dll")]<br />
private static extern short htons(short val);<br />
<br />
[DllImport("ws2_32.dll")]<br />
private static extern long htonl(long val);<br />
#endregion<br />
<br />
Chen Venkataraman
|
|
|
|
|
You have to declare them as a part of a class:
namespace MyNamespace
{
public class MyClass
{
#region P/Invoke stuff
[System.Runtime.InteropServices.DllImport("ws2_32.dll")]
private static extern short htons(short val);
[System.Runtime.InteropServices.DllImport("ws2_32.dll")]
private static extern long htonl(long val);
#endregion
}
}
They cannot be a member of the namespace directly (ie the following code will make the compiler barf in the way that you described)
namespace MyNamespace
{
#region P/Invoke stuff
[System.Runtime.InteropServices.DllImport("ws2_32.dll")]
private static extern short htons(short val);
[System.Runtime.InteropServices.DllImport("ws2_32.dll")]
private static extern long htonl(long val);
#endregion
}
--
Russell Morris
"So, broccoli, mother says you're good for me... but I'm afraid I'm no good for you!" - Stewy
|
|
|
|
|
duh... i gave up after struggling with it for a day. And i've done P/Invoke stuff before & usually could make sense of what the compiler thought was wrong - with this one, i just lost it! Silly me!
Thanks.
Chen Venkataraman
|
|
|
|
|
Hello all !
I am about to develop an application which purpose is to edit information of one or a couple of days...
Here is the approximative final look it should have :
Month --------Janvier----------- ...
Days --Mon--Tue--We--Thu -- ...
Day -- 01 -- 02 -- 03 -- 04 -- ...
Color --Bl -- Wh -- Gr -- Red--...
Price -- 12-- 10 -- 11 -- 12 --...
So let me explain a few things :
- each day is set in a column of a grid (separated by '--' here) and the day of week are drawn on a blue background whereas the WE are green
- please point out the first title column which will be always visible
- the column width is constant whatever the screen width and no scrollbar are visible so that we can browse throught days by clicking around on the calendar (first 3 rows) by implementing the onclick event
- No keyboard edition is allowed. The inputs are made by click or click&drag on the 2 last rows (color&price) depending upon a parameter box previously filled. Like painting on the calendar with the mouse if you see what I mean...
- No selection control should be visible on this grid
- The whole thing should be smooth enough to use for us to feel comfortable.
- the original datas are retrieved using a web service that returns a typed dataset with a row by date.
- another request should be made and datas should be added to the original datas
All that is very beautiful but... there are issues....
So here are my problems :
Should I use a datagrid with columnstyle or draw it by myself on a paintbox ?
What's the best way to implement the databinding between the retrieved dataset and the datagrid (in case I use a datagrid !!) which are reverse in fact (date in rows and date in cols) ?
In case I use a datagrid, should I bind a blank matrix to it in order to fix the number of rows and columns and draw the values retrieved from another dataset, or should I transform the retrieved from WS dataset for it to fit the datagrid orientation ?
Here we are for the moment...
If you have any suggestions or ideas on how to improve or implement my application, feel free to inform me !
Thank you in advance for all and have a good day !!!!!
Guim7
--diving in the abyss of C# and .NET--
|
|
|
|
|
Nobody has a clue ???
please help me!!!!
Guim7
|
|
|
|
|
Hi,
Does anyone know if it is possible to replace an existing COM server with a .NET server without having to rebuild the existing COM clients?
Any help or pointers would really be appreciated,
cheers
Jamie.
|
|
|
|
|
Someone here is very likely much more knowledgable about it... but I can say that it should not require a rebuild if the interface definition does not change. That said, however, I can't imagine you can keep the exact calling semantics between ATL COM or VB OCX and .NET. The types, if nothing else, will probably be different enough to cause a problem... maybe not. Try it. It shouldn't be difficult to code a minor test.
|
|
|
|
|
COM Callable Wrappers (CCW's) - check it out.
HTH
There are only 10 kinds of programmers - those who understand binary, and those who don't.
|
|
|
|
|
Hi All
What is nmake used for?? Can anyone give me an example for its usage ???
Thanxs
Maharishi
Nothing is Impossible. Even impossible spells "i m possible"
|
|
|
|
|
nmake is a build environment tool which uses a "makefile" to execute build instructions. The "makefile" contains variables and commands. Here you go: NMAKE Reference.
|
|
|
|
|
I'm writing a plug-in in VB.NET to a an application called DesktopSidebar for Windows. Right clicking my plug-in's "panel" shows among other things a Properties Dialog. All I need to do is pop up the dialog in the proper place and on the same monitor in a multiple monitor environment. My plug-in doesn't appear at this point to have the Window handle of the calling application. After quite a bit of trial and
error I came up with this:
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Int32,
ByRef lpRect As RECT) As Int32
Public Structure RECT
Dim Left As Int32
Dim Top As Int32
Dim Right As Int32
Dim Bottom As Int32
End Structure
Dim colProcess() As System.Diagnostics.Process
Dim oProcess As Diagnostics.Process
colProcess = Diagnostics.Process.GetProcessesByName("sidebar")
If colProcess.Length > 0 Then
oProcess = colProcess(0)
Dim handle As System.IntPtr = oProcess.MainWindowHandle
Dim loc As RECT
If GetWindowRect(handle.ToInt32, loc) > 0 Then
'Where are we docked?
If loc.Left = 0 Then
Me.Location = New Drawing.Point(loc.Right,(loc.Bottom -
loc.Top)/2)
Else
Me.Location = New Drawing.Point(loc.Left - Me.Width,
(loc.Bottom - loc.Top)/2)
End If
End If
End If
This works great as long as you have a single monitor, whether DesktopSideBar is docked to the Left or the Right. However, I run in a
multi-monitor environment. In my particular setup my primary display is my laptop and my secondary display actually hovers ABOVE my primary display (it's a 19 inch monitor) and I have my desktop extended onto it. The code above, only targets the primary display, even though I dock DesktopSideBar on my secondary monitor. My screen coordinates are still good... just not on the right monitor.
Could anyone offer up some suggestions on how to not only determine the monitor my panel is on, but also how to set the location of my dialog to a specific place on the proper monitor?
|
|
|
|
|
When running an application on a multiple monitor environment the coordinates of the form are the coordinates for the combined desktop.
The .NET Framework provides the Form.DesktopLocation property to set and get the location of forms in multimonitor environments. So, in the code you posted above you should remove stataments like
Me.Location = New Drawing.Point(loc.Right,(loc.Bottom -
loc.Top)/2)
replacing them with
Me.DesktopLocation = New System.Drawing.Point(loc.Right,(loc.Bottom -<br />
loc.Top)/2)
|
|
|
|
|
how to access web service with SSL from windows application (C#)?
How to use the certificate in the client windows application/
Is there any sample available?
Thanks a lot.
|
|
|
|
|
Hi!
I have the following:
function(Control theControl)
{
// At this point I know that the control has an items property
if (theControlis ListBox) ((ListBox)ctrl).Items.Clear;
if (ctrl is ComboBox) ((ComboBox)ctrl).Items.Clear;
}
You guru's probably already know my question...
How can I create a generic solution here?
something like:
function(Control theControl)
{
// At this point I know that the control has an items property
((theControl as Type)ctrl).Items.Clear;
}
|
|
|
|
|
What you need is an interface. If all Controls with .Items implemented a particular interface, something like IHasItems, then you could do a generic implementation. Unfortunately, there is no IHasItems interface, so you're SOL.
You could create a wrapper class around a Control, create an IHasItems interface and implement it yourself. For instance,
Define an interface like so:
public interface IHasItems
{
IList Items
{
get;
}
}
Then inherit a class from each control you need to use, while implementing that interface:
public class ListBoxEx: ListBox, IHasItems
{
...
}
That's it, you can then pass any IHasItems implementer into your function
function(IHasItems theControl)
{
theControl.Items.Clear();
}
Now, with that solution you're going to have to guarantee that the .Items property will return something with a .Clear() method, but you get the picture.
Hope that helps.
The graveyards are filled with indispensible men.
|
|
|
|
|
I just checked and the above solution will indeed work. However, that is quite a bit of extra work (you have to create an interface, then create a wrapper class).
Instead of that, why not just make your function accept an IList instead of a Control? For instance,
public void function(IList items)
{
items.Clear();
}
Then pass the items to it like:
ComboBox combo = new ComboBox();
ListBox listBox = new ListBox();
function(combo.Items);
function(listBox.Items);
That is an easier solution and will work equally well. If your function requires the Control, not just the .Items, then you should use the first solution I posted.
The graveyards are filled with indispensible men.
|
|
|
|
|
Hi Judah,
Thanks for your input. I'll try it out and see if that's what I need.
|
|
|
|
|
Both Listbox and ComboBox inherit from ListControl , so it would be somewhat logical to assume that's where the Items porperty comes from. If only it were that easy.
Although they share a common name, Items properties represent differents type of objects in Listbox and ComboBox (ListBox.ObjectCollection and ComboBox.ObjectCollection , respectively).
Therefore, there's no common ancestor you can cast to and call Items.Clear() .
As for your question of how to create a generic solution, there is a way, although it may be overkill for what you're looking for.
using System.Reflection;
object collection = ctrl.GetType().GetProperty("Items").GetValue(ctrl, null);
collection.GetType().GetMethod("Clear").Invoke(collection, null); Alas, the 'generic' solution is usually not the easiest
Charlie
if(!curlies){ return; }
|
|
|
|
|
Oops. Upon further reflection (no pun intended) and reading the other proposed solution, I realized that once
you've got your object collection, you can cast is to IList and call
Clear() on it. So the second line would become:
object collection = ctrl.GetType().GetProperty("Items").GetValue(ctrl, null);
((IList)collection).Clear();
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hi Charlie,
This was what I was looking for!
Thanks a lot.
John
|
|
|
|