|
I don't consider myself an expert, but I use COM for different purposes. In my view the great advantage of late binding is version independency.
Therefore I make the reference to outlook without the version number, and that works fine by me and my clients who run different versions of Outlook.
Your code would be:
Type Comtype = Type.GetTypeFromProgID("Outlook.Application");
object obj = Activator.CreateInstance(Comtype); //The exception is here
I hope this helps.
Regards
|
|
|
|
|
I have been having this problem for some time and I believe it must steam from my misunderstanding of some basic concept. That said can someone please set me straight on the matter of usable form size.
In the below instance I am looking to create a line with a ten pixel boarder at the top and bottom. When the code is run as expected there is a 10 pixel gap at the top however the bottom of the line goes off the screen and needs an additional 35 pixels added for the desired effect. Can some kind person please tell me why and how I should measure the form height if not like this.
Jason
System.Drawing.Graphics graphicsObj = this.CreateGraphics();
graphicsObj.DrawLine(new Pen(Color.Blue, 4), new Point(110, 10), new Point(110, this.Height - 10));
|
|
|
|
|
Try this.Bottom, instead of this.Height, perhaps?
Forget it, i was wrong...
Sorry.
var question = (_2b || !(_2b));
|
|
|
|
|
Ok. This should work, I hope.
Instead of this.Height try this.ClientRectangle.Height
Seems to have worked for me
I guess when you do this.Height it takes into account the titlebar and all that.
And sorry for the "this.Bottom" post just above, but for some reason it was the first thing to have popped into my mind.
var question = (_2b || !(_2b));
|
|
|
|
|
Fantastic that’s exactly what I needed but didn’t have a handle on where to start looking.
Thank you very much.
|
|
|
|
|
assuming "this" is a form, you're not taking into account the window borders, and any other controls (toolbars, menus, etc)
Try using this.ClientSize.Height instead
|
|
|
|
|
thank you also even thought you were a whole minute slower
|
|
|
|
|
Dear all
I have Convert vs2005 code to vs2008 in c# it works fine in vs2005 but gives error in vs2008 it compiles but when i press f5 it give error while running project unable to start debugging . it is BHO project.
|
|
|
|
|
What's the error message and what's BHO?
Regards,
Rob Philpott.
|
|
|
|
|
The error is [Error while trying to run project: Unable to start debugging] and BHO mean A browser helper object. we get IE explorer events through BHO and gives our own functionality
|
|
|
|
|
|
Hi,
I have used the following code for the Tcp client server communication...
When i run the Client.cs, it gives me an error stating:
Error....at System.Net.Sockets.TcpClient.Connect<string int32="" port="">..What changes should i do for the ipaddress and port..please help me with this...
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Diagnostics;
using System.Runtime;
using System.Text;
public class Server
{
public Server()
{
}
public static void Main()
{
try
{
IPAddress ipAd = IPAddress.Parse("192.168.1.32");
TcpListener myList = new TcpListener(ipAd, 8006);
myList.Start();
Console.WriteLine("The server is running at port 8006...");
Console.WriteLine("The local End point is :" + myList.LocalEndpoint);
Console.WriteLine("Waiting for a connection.....");
Socket s = myList.AcceptSocket();
Console.WriteLine("Connection accepted from " + s.RemoteEndPoint);
byte[] b = new byte[100];
int k = s.Receive(b);
Console.WriteLine("Recieved...");
for (int i = 0; i < k; i++)
Console.Write(Convert.ToChar(b[i]));
ASCIIEncoding asen = new ASCIIEncoding();
s.Send(asen.GetBytes("The string was recieved by the server."));
Console.WriteLine("\\nSent Acknowledgement");
s.Close();
myList.Stop();
}
catch (Exception e)
{
Console.WriteLine("Error..... " + e.StackTrace);
}
}
}
|
|
|
|
|
Which line throws the exception - and what is the exception?
Regards,
Rob Philpott.
|
|
|
|
|
Hi
i am sorry i pasted the server code instead of the client in the previous post..
This is the code for the client
the line
tcpclnt.Connect("192.168.0.2",8001);
gives me the error
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Net.Sockets;
public class clnt {
public static void Main() {
try {
TcpClient tcpclnt = new TcpClient();
Console.WriteLine("Connecting.....");
tcpclnt.Connect("192.168.0.2",8001);
Console.WriteLine("Connected");
Console.Write("Enter the string to be transmitted : ");
String str=Console.ReadLine();
Stream stm = tcpclnt.GetStream();
ASCIIEncoding asen= new ASCIIEncoding();
byte[] ba=asen.GetBytes(str);
Console.WriteLine("Transmitting.....");
stm.Write(ba,0,ba.Length);
byte[] bb=new byte[100];
int k=stm.Read(bb,0,100);
for (int i=0;i<k;i++)>
Console.Write(Convert.ToChar(bb[i]));
tcpclnt.Close();
}
catch (Exception e) {
Console.WriteLine("Error..... " + e.StackTrace);
}
}
}
|
|
|
|
|
I think the Connect method of TcpClient, or rather the overload you're using requires the Server's hostname, as opposed to its IP as a string.
So try
tcpclnt.Connect("YourServerName",8006);
Worked for me ;>
Or use a different overload of the Connect method.
I need to investigate a bit further into that, cos this stuff is great!
var question = (_2b || !(_2b));
|
|
|
|
|
Hi
how is that i can find the server's hostname?
|
|
|
|
|
OK.
If you don't know the computer's name, try this:
byte[] zb = { 192, 168, 0, 5 };
System.Net.IPAddress ipa = new System.Net.IPAddress(zb);
System.Net.IPEndPoint Ipep = new System.Net.IPEndPoint(ipa, 8006);
TcpClient tcpCl = new TcpClient();
tcpCl.Connect(Ipep);
I just figured you would have known your server's name, that's all.
But this works just as well (if not better).
var question = (_2b || !(_2b));
|
|
|
|
|
Perhaps you could post the actual exception.
Often e.Source and e.Message are useful as well as the e.StackTrace.
I have no problem using:
myClient.Connect("xxx.xxx.xxx.xxx", port);
in my current project. I'm using UdpClients but the overloads for .Connect are the same.
---------------------------------------------
Help... I'm embedded and I can't get out!
If they don't get the basic research and learning skills down then they'll end up having a very hard life (Either that or they'll become managers) - Micheal P Butler
|
|
|
|
|
|
Dear Yesu Prakash,
After reading your post I think I could give you the anwsers on your questions.
Question 1: I need to develop in C#?
What you mean is probably: do I need to develop this in C#?
The anwser is yes. Because if you use another language for example Java, you are betraying Microsoft and this would mean people won't like you in these forums. There is also a possibility to use Assembly, which I would prefer, because this is simple and plain. You can talk directly to the ports of the computer, so it would be easy to send your bits there.
Question 2: How can I start development?
Simple: open notepad and do your thing
Question 3: What is the idea behind voice conference?
If I understand your question (which I doubt) I would say the idea behind voice conference is hearing people which are not in your room. That you can talk to people over the computer, maybe even the internet. This is just for easy communication.
Question 4: What are the alternative ways?
Alternative ways are as following:
1. in stead of starting your computer (and waste the environment) you could just go out for a walk, walk to the friend you would like to speak and knock on his door
2. You could take the bike or car
3. You could pay people money to make such an app for you
4. You could ask this question on another forum
....
As we say in Holland: there are many ways which will lead to Rome... this means that there's always another way to do your thing.
Well good luck and I hope you understand that half of my post is sarcasme.
modified on Monday, February 23, 2009 7:56 AM
|
|
|
|
|
Deresen wrote: 1. in stead of starting your computer (and waste the environment) you could just go out for a walk, walk to the friend you would like to speak and knock on his door
2. You could take the bike or car
3. You could pay people money to make such an app for you
4. You could ask this question on another forum
Epic fail, you totally forgot the cell or telephone. don't forget, videotaping your message and mailing it to the recipient.
|
|
|
|
|
if you dont know the answer then shut up man..
i guess u can answer the following doubts...
1. plese help me to write code for adding two integers..
2. concatenate string "hello" and "world"..
i am expecting your valuable help asap
thankyou
|
|
|
|
|
I'm sincerely sorry mister Yesu....
You should be the one thinking about your questions, not just wasting your energy blaming other which didn't give the anwser you expected.
I gave you the anwsers on your questions, not really seriously, but nobody else could've done it better, because you didn't explain what you really wanted to do.
Again: if you would like some good anwsers, then please make sense with asking questions.
the anwser on question 2 is to hard for me, I really don't know how to do this .... but the two integers isn't really tough:
int myFirstNumberWhichIsFarToLong, secondNr;
myFirstNumberWhichIsFarToLong = 4;
secondNr = 5;
int outcome = 0;
outcome = myFirstNumberWhichIsFarToLong * secondNr;
for(int i = 0; i < myFirstNumberWhichIsFarToLong - 2; i++)
{
outcome -= (myFirstNumberWhichIsFarToLang * secondNr);
}
outcome += myFirstNumberWhichIsFarToLong;
Console.out.WriteLine("oucome should be 9: " + outcome);
This will only work when the first integer is 2 or higher and the second is 0 or higher.
Good luck
|
|
|
|
|
|
Hi guys,
Hi guys, I am implementing a download cache engine for my application. When I read that the file's LastModified is not newer than my local file, I do not download the file: When I first downloaded the file, I set the file date to the LastModified date from the response. If I request to download the same file in same session in the application again, it takes a long time in the HttpWebRequest's GetResponse() or may fail eventually in timeout.
I did close the response before proceeding on. And I set the HttpWebRequest's KeepAlive to false.
Any solutions or workaround?
Thank you in advance!
|
|
|
|