|
Hi!
You could also try using the Application.Idle event instead of your timer. That way the menu item click is simulated when the application is finished initializing the main form.
Regards,
mav
|
|
|
|
|
I am new to remoting and have created 3 projects on the same machine
1) Server object
2) Server activation object
3) Client
The client calls the server activation object which includes specifying a URI to show where the Server activation application resides. This client code might look something like this...
TcpClientChannel ch = new TcpClientChannel();
ChannelServices.RegisterChannel(ch);
RemotingConfiguration.RegisterWellKnownClientType(
typeof(SAO_server_single_call.clsSAO_singlecall),
"tcp:davelaptop:1234/clsSAO_singlecall");
objSAO_singlecall = new SAO_server_single_call.clsSAO_singlecall();
Can anybody tell me how to work out how the URI should be constructed? I've not used them much before. My computer is called 'davelaptop' and the client activation server project lives at 'D:\Work\Exercise\RemotingTest\RemotingTest\TestServer'
Can anyone tell me what the URI should look like or tell me where I'm going wrong?
Thanks in advance - Dave
|
|
|
|
|
The URI doesn't have anything to do with the physical location of the server. You only need to provide the port number of the channel which you registered on the server. For example, if your server code looked like this
ChannelServices.RegisterChannel(new TcpChannel(8082));
RemotingConfiguration.ApplicationName = "HelloServiceApplication";
RemotingConfiguration.RegisterWellKnownServiceType( typeof(HelloService),
"MyUri",
WellKnownObjectMode.SingleCall
);
Then the client call will look like
RemotingConfiguration.RegisterWellKnownClientType(
typeof(SAO_server_single_call.clsSAO_singlecall),
"tcp://localhost:8082/HelloServiceApplication/MyUri");
Quoted from MSDN[^]
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
im using visual studio beta 2
i have richtextbox and listbox in my C# windows application.
my application works like intellisense/Autocomplete like typing System, then a "."
inside Visual Studio .NET will show a drop down list of types for the System namespace.
when i type a recognized word into the richtextbox then a period/fullstop,
a listbox appears.
problem:
how do i position my listbox to appear right after the period('.') i would have typed in my richtextbox
code example would be appreciated
thanks
regards paula
|
|
|
|
|
listBox.Location = richTextBox.GetPositionFromCharIndex(richTextBox.SelectionStart);
|
|
|
|
|
how do i play short wav file in c# then stop when it finishes.
i have a timer that will fire when a remote server goes offline, the timer_tick fires every 10000 millisec, and the wav file is 1.5 secs long.
when i use the code below and play synchronisly it just repeats continouslyand seems to stall the form, as i cant click the button to shut it up
if i play it asynchronously, then it plays over the top of itself repeatedly
how can i just play it one every 10 seconds until i cancel it ?
<br />
if(online)<br />
{<br />
this.stationStatus.Text = "ONLINE";<br />
this.stationStatusPicture.Image = this.statusImages.Images[0];<br />
}<br />
else<br />
{<br />
this.recogniseAlertButton.Visible = true;<br />
<br />
offlineTimer = new Timer();<br />
offlineTimer.Interval = 10000;<br />
offlineTimer.Tick += new EventHandler(offlineTimer_Tick);<br />
offlineTimer.Start();<br />
} <br />
<br />
WSounds ws;<br />
private void offlineTimer_Tick(object sender, EventArgs e)<br />
{<br />
ws = new WSounds();<br />
<br />
try<br />
{<br />
ws.Play("offline.wav", ws.SND_FILENAME);<br />
<br />
this.stationStatus.Text = "OFFLINE";<br />
this.stationStatusPicture.Image = this.statusImages.Images[1];<br />
}<br />
catch(IOException ioe)<br />
{<br />
Debug.WriteLine(ioe.Message);<br />
}<br />
}<br />
<br />
public class WSounds<br />
{<br />
[DllImport("WinMM.dll")]<br />
public static extern bool PlaySound(string fname, int Mod, int flag);<br />
<br />
public int SND_ASYNC = 0x0001;
public int SND_FILENAME = 0x00020000;
public int SND_PURGE = 0x0040;
<br />
public void Play(string fname, int SoundFlags)<br />
{<br />
PlaySound(fname, 0, SoundFlags);<br />
}<br />
<br />
public void StopPlay()<br />
{<br />
PlaySound(null, 0, SND_PURGE);<br />
}<br />
}<br />
kid regards,
g00fy
|
|
|
|
|
How is SQL generally handled? I'm building my first application for windows using c# and have just finished up the base class for the application forms to inherit from.
Next, I'm wondering how to handle the SQL (connection, selects, inserts, updates, deletes) and wondering if these should all go into there own class. One class per table or something like that as opposed to having each form use it's own set of SQL. ex: Customer form loads a grid using customer table. Customer search populates a listbox from customer table and displays this in a dialog. Customer edit takes an existing record (or allows the creation of a new record). 3 seperate forms. Should 1 class handle the customer SQL or would you handle that individually in each of the 3 forms? (frmGrid, frmSearch, frmEdit) I'm concerned that if anything changes (and it probably will) within the table, I'd need to search through each form that uses that table to handle mod's.
Thanks for any guidance you can offer!
|
|
|
|
|
I usually put all my database handling into one class and have any forms that need to access the database keep a reference to that class. I have my database class manage the connection, all the different data adapters and all the data tables.
|
|
|
|
|
Excellent and thank you for such a quick response. I'll start in on this today!
|
|
|
|
|
|
Awesome link. I'm not familiar with ORM, so I've bookmarked that URL and will give it a read!
Thanks
|
|
|
|
|
I have a project with a main form that accesses inherited forms with their appropriate .dll's. I have several that work fine. However, the latest form gives me the following error when I try to compile the main form:
" "_Form() is inaccessible due to its protection level
I understand what it is saying. I just dont see why. I am able to compile and run the inherited form separately with no problem. However, once I call it from my main form, I receive the previous error. Any help would be much appreciated. Thanks.
D
|
|
|
|
|
Is the _Form declared as protected instead of public as it should be?
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
spif,
Thanks for the quick response. However, the form is declared as public. public _Form(){}
Any other ideas? I am assuming it isn't a user control because it would give me this error when I run the application stand-alone. What could it be?
D
|
|
|
|
|
spif,
Thanks again for your help. You got me going in the right direction. The form was declared null within the protected override void dispose method. Thanks again for everything.
|
|
|
|
|
Try to write the whole namespace in front of the initialization.
ex.
System.Windows.Forms.Form f = new System.Windows.Forms.Form();
^^replace with the _Form's namespace.
There may be another Form with same name which is inaccesable (private or protected)
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
how can i import data from any access,oracle dbase to sql server
|
|
|
|
|
Using DTS.
---
b { font-weight: normal; }
|
|
|
|
|
I have to admit its an odd thread title, but it almost describes what I want to do.
Let say I have the following class
class Duck
{
public string name;
public int age;
public bool isMale;
}
I need to be able to access these class vars from strings. Lets say I have the following instance of the Duck class
Duck myDuck = new Duck();
myDuck.name = "fred";
myDuck.age = "2";
myDuck.isMale = false;
Elsewhere in the code I have the following strings, and I need to use these strings to access the member variables of the myDuck instance. I know this could be done with if/else/switch etc but I am curious to learn if there is a way to do this with less code.
string varName_DuckName = "name";
int varName_DuckAge = "age";
bool varName_duckIsMale = "isMale";
And example (ish) of what I want to do already exists in the .NET framework for the Color class where you can call:
Color.FromName("red")
So I would like to be able to do something like
bool b = (bool)myDuck.FromName("isMale")
Which is the case of the example above would set b as false
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
You are searching for reflection.
Your method could look like the following:
public class Duck {
public object FromName(string fieldName) {
this.GetType().GetField("fieldName").GetValue(this));
}
}
You can invoke about everything you want by using reflection mechanisms. Just explore the Type class and the System.Reflection namespace.
|
|
|
|
|
Hi
i have one data set suppose X=(2,4,6,8) and calculated mean is 5 and standard deviation is 3.162. i don't hv Y value so plz tell me how can i plot graph with the help of data set, mean and SD.
|
|
|
|
|
How can I use .class files created using java in my C# application???
---------------------------------
There is no patch for ignorance
|
|
|
|
|
reverse compile it and port to J# would be one way, dont know of any other, never done it
regs,
g00fy
|
|
|
|
|
|
Iam trying to buid an online forum .(the onw which looks like this forum for example)
I want to know how to do it?
plz help me..
venkat
|
|
|
|