|
Hi All,
Is there anyway to access the reuuning instance of an object in a application from another application. Both the applications are built using C#. I have tried using the GetActiveObject, but it seems used for COM objects. Is there any method available for managed objects. I don't want to use remoting.
Thanks in advance
Diana.
|
|
|
|
|
Hi diana it's very nice question. I like this kind of developement.
I think This possible through Interprocess communication.
Actually i have no time for implement this thing.
Plz refer this url it may be assist.
http://msdn2.microsoft.com/en-us/library/aa446520.aspx
http://msdn2.microsoft.com/en-us/library/aa365574.aspx
Plz inform what kind of you have exact need.
If u face further problem plz inform me.....
-- modified at 12:17 Monday 29th January, 2007
Parwej Back...............DON of Developer.......
Parwej Ahamad
g_parwez@rediffmail.com
|
|
|
|
|
Hi Parwej,
Thanks for the reply.
I want to get hold of an object from a different application for automated testing purpose.
Diana.
|
|
|
|
|
I'm writing an application on Windows XP which is tested on Windows 2000 and 2003 Server. It works fine on XP and Windows 2003, but on 2000 it behaves differently. The ListView component does not show Groups for example. Is there any way to get ListView to behave the same on each platform?
|
|
|
|
|
Hello!
I'm trying to findout how to catch event between changing rows in ListView . I don't want to use ListView.SelecetIndexChanged , I need to catch an event in time of changing. Do anyone of You know how to do it?
|
|
|
|
|
By 'changing' do you mean editing a list item? There is the AfterLabelEdit or BeforeLabelEdit events...
If you mean changing as in selecting a different item, then what is wrong with SelectedIndexChanged ?
|
|
|
|
|
Problem is more complicated. In my Form there is a ListView and nearby are TextBoxe's . When You Select a row in ListView in TextBoxe's are shown detailed information about this Row, there is a possibility of changing this data. When You change a selection to another row (and data in TextBox'es are changeg by You) I'd like to show a MessageBox with question Accept/Cancel.
Is it more clear now
|
|
|
|
|
Yes, I see now Personally, I would try and avoid lots of "Are you sure?" type pop ups. Especially if it's going to do it every time you select a new item. They can get very annoying for users. I would consider building a databound UserControl for my textboxes then you can update the databound object directly. If you use a DataTable with a DataRow as the databound object you could could use RowState to aid the implementation Accept/Cancel if you wanted.
|
|
|
|
|
Hi, could anyone please help me to upgrade my syntax in c#..
for (int x = 0; x <= DSData.Tables[0].Rows.Count; x++)<br />
{<br />
x1.Text = DSData.Tables[0].Rows[x]["test"].ToString();<br />
}
dataset DS;
foreach (________ in DS)
{
}
??
Dabsukol
|
|
|
|
|
foreach (DataRow row in DS.Tables[0])
{
x1.Text = row["test"].ToString();
}
|
|
|
|
|
shouldn't that be
DS.Tables[0].Rows
??
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Yes... I did that the other day too
|
|
|
|
|
Personally I would not do the "upgrade" in the first place as your code will actually run slower. Unless you have a compelling reason to do so rather do the following:
int rowCount = DSData.Tables[0].Rows.Count;
for (int x = 0; x < rowCount ; x++)
{
x1.Text = DSData.Tables[0].Rows[x]["test"].ToString();
}
|
|
|
|
|
My test says otherwise:
DataTable dt = new DataTable("table1");
DataColumn dc = new DataColumn("col1");
dt.Columns.Add(dc);
for (int i = 1; i < 1000000; i++)
{
DataRow row = dt.NewRow();
row["col1"] = "string" + i.ToString();
dt.Rows.Add(row);
}
long start = DateTime.Now.Ticks;
for (int i = 0; i < dt.Rows.Count; i++)
{
string s = (string)dt.Rows[i]["col1"];
}
long middle = DateTime.Now.Ticks;
foreach (DataRow r in dt.Rows)
{
string s = (string)r["col1"];
}
long end = DateTime.Now.Ticks;
TimeSpan forLength = new TimeSpan(middle - start);
TimeSpan foreachLength = new TimeSpan(end - middle);
Console.WriteLine("for = " + forLength.ToString());
Console.WriteLine("foreach = " + foreachLength.ToString());<pre>
Output:
<code>for = 00:00:00.9079668
foreach = 00:00:00.2661282</code>
But in the scheme of things, less than a second to process 1000000 records, either way fine by me.
|
|
|
|
|
I stand corrected then
I was going according to the MSDN Documentation on enumeration overhead. Thanks for the info.
|
|
|
|
|
I would suggest you enclose all of that in another for loop that performs 2 or more
passes, just to get rid of some effects such as data cache hits.
Any first pass measurement typically is unreliable.
Luc Pattyn
|
|
|
|
|
Good idea:
pass 1:
for = 00:00:00.0312510
foreach = 00:00:00.0156255
pass 2:
for = 00:00:00.0625020
foreach = 00:00:00.0312510
pass 3:
for = 00:00:00.0937530
foreach = 00:00:00.0312510
pass 4:
for = 00:00:00.1562550
foreach = 00:00:00.0468765
|
|
|
|
|
Well, even these measurements are not trustworthy,
your system timer seems to tick in increments of 15.6 msec
so that is also the margin of error.
I now suggest you redo it in this way:
int maxIter=100;
for (int pass=0; pass<4; pass++) {
start timer (or read DateTime.Now.Milliseconds)
for (int iter=0; iter<maxIter; iter++) {
code to be timed
}
stop timer
start timer
for (int iter=0; iter<maxIter; iter++) {
alternative code to be timed
}
stop timer
}
Luc Pattyn
|
|
|
|
|
Just for fun I did the test 1000 times and got the following results:
for: 00:12:08.2600974
foreach: 00:03:40.6635750
Note that this is total time for 1000 runs; the result seems clear though.
Internet - the worlds biggest dictionary
|
|
|
|
|
go with foreach !
Luc Pattyn
|
|
|
|
|
Hello,
andre_swnpl wrote: as your code will actually run slower
Why do you think that?
andre_swnpl wrote: Rows[x]"
If you really safe time with the for instead of the foreach, than you will loose it here again, I think!
All the best,
Martin
|
|
|
|
|
hello
my question is that i'm getting a page HTML by my code.what i want....to make the thumbnail image of this HTML display like we do by "PRINTSCREEN" button.
can i do this?
thanx
Dotnet
|
|
|
|
|
Hi,
Im writing a very simple network chat app. This is only a chat app for two people over network.
Here is my code:
<br />
public partial class MyChat : Form<br />
{<br />
Socket sock;<br />
Thread receiver;<br />
static IPAddress localIPAddr;<br />
static int intPort;<br />
IPEndPoint multiep;<br />
<br />
public MyChat()<br />
{<br />
InitializeComponent();<br />
<br />
localIPAddr = IPAddress.Parse(txtHost.Text);<br />
intPort = Convert.ToInt32(txtPort.Text.ToString());<br />
<br />
multiep = new IPEndPoint(localIPAddr, 4040);<br />
sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); <br />
<br />
IPEndPoint iep = new IPEndPoint(IPAddress.Any, intPort);<br />
sock.Bind(iep);<br />
<br />
sock.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(localIPAddr));<br />
<br />
receiver = new Thread(new ThreadStart(packetReceive));<br />
receiver.IsBackground = true;<br />
receiver.Start(); <br />
}<br />
<br />
void packetReceive()<br />
{<br />
EndPoint ep = (EndPoint)multiep;<br />
byte[] data = new byte[1024];<br />
string stringData;<br />
int recv;<br />
while (true)<br />
{<br />
recv = sock.ReceiveFrom(data, ref ep);<br />
stringData = Encoding.ASCII.GetString(data, 0, recv);<br />
rtxtMsgWindow.AppendText("from " + ep.ToString() + ": " + stringData);<br />
}<br />
}<br />
<br />
private void btnExit_Click(object sender, EventArgs e)<br />
{<br />
receiver.Abort();<br />
sock.Close();<br />
Close(); <br />
} <br />
<br />
private void txtMessage_KeyPress(object sender, KeyPressEventArgs e)<br />
{<br />
if (e.Handled = e.KeyChar == 13)<br />
{<br />
byte[] message = Encoding.ASCII.GetBytes(txtMessage.Text);<br />
txtMessage.Clear();<br />
sock.SendTo(message, SocketFlags.None, multiep);<br />
}<br />
}<br />
}<br />
<br />
Problem is i get the following socket exception The requested address is not valid in its context at the line of code i made bold above.
The specified ip address would be my own ip address to test and see if the message gets posted. If this is the problem is there any other way i could get around this maybe a different way of socket programming maybe using tcpclient or something?
Im a noob to sockets or network programming pls help thx
Regards
|
|
|
|
|
Hi.
I'm writing a client for a webservice which is built on Java. Some operations provided by the service send attachments to the client calling them. The standard used by the server for this task is MIME(SOAP with Attachments). As some of you might know, the .NET Framework and WSE don't have(and never will have) any support for SwA/MIME.
Does anyone has knoleddge of the existance of a good free/afordable component for .NET which can handle MIME responses from webservices? I only found one such beast, written by Alotsoft, but it cost $5000...
Thanks Alot.
|
|
|
|
|