|
hi all,i'm creating a mobile appliction with ms vs2005 release edition, im using a webservice from www.webservicex.com and i get the exception with the details :
Status :System.Net.WebExceptionStatus.ConnectFailure
System.Net.WebException was unhandled
Message="Could not establish connection to network."
StackTrace:
at System.Net.HttpWebRequest.finishGetResponse()
at System.Net.HttpWebRequest.GetResponse()
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse()
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse()
at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke()
at DeviceApplication2.net.webservicex.www.lengthUnit.ChangeLengthUnit()
at DeviceApplication2.Form1.button1_Click()
at System.Windows.Forms.Control.onclick()
at System.Windows.Forms.Button.onclick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at DeviceApplication2.Program.Main()
&here's my code:
private void button1_Click(object sender, EventArgs e)
{
net.webservicex.www.lengthUnit l = new
DeviceApplication2.net.webservicex.www.lengthUnit();
double x = l.ChangeLengthUnit(120, DeviceApplication2.net.webservicex.www.Lengths.Feet, DeviceApplication2.net.webservicex.www.Lengths.Meters);
MessageBox.Show(x.ToString());
}
please tell me where is the error (i'm deploying it using the device emulator and the active sync program)
|
|
|
|
|
|
I have written a C# DLL that I intend to call from an unmanaged C++ app. I have so far followed all the rules that Microsoft explains in this article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vcwlkcominteroppart2cservertutorial.asp[^]. My ultimate goal is to have a method in the C# DLL which will populate a string OUT parameter, and call it from C++. Something like void GetErrorString( int iErrorCode, ref string szErrorString ) . Now do not take that signature seriously - because that is what the question is! What should be the signature???? And how exactly do I call it from C++?
So far I have tried:
Attempt 1.
C# signature:
void Func2( int iCode, ref char [] szOut );
C++ call:
char szRetString[ 128 ];<br />
cpi->Func2( 10, &szRetString );
Result: Runtime error
Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result.
Variation: Instead of "ref" in C#, tried without ref. Same result.
Attempt 2.
C# signature:
void Func2( int iCode, ref string szOut );
C++ call:
char szRetString[ 128 ];<br />
cpi->Func2( 10, &szRetString );
Result: Runtime error
Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result.
Variation: Instead of "ref" in C#, tried without ref. Same result.
Attempt 3.
C# signature:
void Func2( int iCode, ref StringBuilder szOut );
C++ call:
char szRetString[ 128 ];<br />
cpi->Func2( 10, &szRetString );
Result: Runtime error
Variation: Instead of "&szRetString" in C++, tried "szRetString". Same result.
Variation: Instead of "ref" in C#, tried without ref. Same result.
And all the cross-variations of the above combinations as well!!!!
Can somebody please tell me where am I going wrong? My C++ project does not have UNICODE defined. But please note that I have succeeded in calling the example provided by the MSDN article (link above) - which means I am successful in sending a read - only copy of string as IN parameter into C#.
Ever wondered that microsoft examples avoid the harder part?;)
Koushik Biswas
-- modified at 16:06 Thursday 2nd March, 2006
|
|
|
|
|
Ok so I have this method:
<br />
public static string ConvertFileName(string fn)<br />
{<br />
Regex.Replace(fn, "[^\\w\\s\\.\\{}_\\-\\$&\\^!;#\\+=%]", "_");<br />
<br />
if (fn.Length > 31)<br />
fn = fn.Substring(0, 28) + ".doc";<br />
<br />
return fn;<br />
}<br />
It is supposed to take the string fn and replace any characters that do not match the regex given with underscores. For example the file name: "Horses (Big Ones).doc" should be made into "Horses _Big Ones_.doc". However, it changes nothing right now. Any suggestions what the issue is here. Ran it through a regex tester at http://www.fileformat.info/tool/regex.htm it ran fine there.
Thanks
-- modified at 15:40 Thursday 2nd March, 2006
|
|
|
|
|
That is because you do the replacement and throw away the result. The Replace method returns a string, you have to take care of the return value.
---
b { font-weight: normal; }
|
|
|
|
|
Wow... I'm going to uninstall VS, give my computer to charity, and become a monk now. I feel like an idiot. Thank you for the quick and correct response
|
|
|
|
|
I could not help stopping expressing my satisfaction on the software "RegexBuddy" for Generating Regex Snippets. This software will take description from you and generate Right Regex Snippet for you.
http://www.regexbuddy.com/
|
|
|
|
|
|
anyone know about how to extract attribute's values from meta tags in html using regular expression or dom??
|
|
|
|
|
Hi,
I have written code to dispay an xml file on the command prompt, but wierdly, I am getting system.setting[] as the output instead of the xml file..I have entered in parameters such as /xml and a path.
Here is my code..
Can anyone tell me what wrong and why I am getting a difference output ?
using System;
using System.Xml;
namespace EliteDMSUtilities
{
///
/// Summary description for Class1.
///
class EntryPoint
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
//string[] args = new string[10];
//args[0] = "/xml";
//args[1] ="C:\Test\Elite_Dms_SystemSetting.xml";
if( args.Length >0)
{
if(args.GetValue(0).ToString()== "/xml")
{
Execute_Cmd_xml(args);
}
else
{
Console.WriteLine("Unrecognized command");
Console.ReadLine();
}
}
}// end of main
static void Execute_Cmd_xml(string[] args)
{
Console.WriteLine(args.ToString());
string sIFolderName ="";
try
{
XmlDocument doc = new XmlDocument();
if (args.Length > 1)
{
for(int i=1; i < args.Length; i++)
sIFolderName = sIFolderName + " " + args.GetValue(i).ToString().ToLower();
sIFolderName = sIFolderName.TrimStart();
Console.WriteLine(sIFolderName);
doc.Load(sIFolderName);
Console.Write(doc.OuterXml);
Console.ReadLine();
}// end if
}
catch(XmlException xmlEx)
{
Console.WriteLine("Failed to load " + sIFolderName, xmlEx.Message);
}
}
}
}
Thanks
|
|
|
|
|
Hello,
I just had a general question about MSComm32 or Serial Communications in .NET. When using binary transmission and receive with RThreshold = 1 (OnComm fired after every byte), does the transmission of binary data act the same as the receive data? Meaning, do I have to place one byte at a time in the MSComm.output field or can I place a whole byte array into MSComm.output?
I tried looking for examples, but every sample I found uses text transmission or is in Win32 Native.
Any help is much appreciated. Thanks in advance.
Mike
|
|
|
|
|
hi all, im creating a pocket pc application that uses some web services,
using ms visual studio 2005 release edition(not the beta version). i have downloade active sync and i'm using the device emulator (pocket pc 2003 se) to deploy the application but i get the error "unable to connect to remote server" ,any help?
|
|
|
|
|
|
Because you posted it on at least 3 different forums on this site within minutes of each other.
Doing something like that will not get you an answer any faster, and may annoy someone who does know it enough that they won't bother to reply.
-- modified at 13:44 Thursday 2nd March, 2006
|
|
|
|
|
Unable to solve ... please help
CODE:
-----
public ProductObject[] OProduct;
ArrayList myProduct;
public void MyProduct()
{
ProductObject OProduct = new ProductObject();
myProduct = new ArrayList();
for (int i=1; i<=10; i++)
{
OProduct.Loader(i);
myProduct.Add(OProduct);
}
OProduct = (ProductObject[])myProduct.ToArray(typeof(OProduct));
}
ERROR:
------
Cannot implicitly convert type OProduct[] to OProduct
|
|
|
|
|
Pete Madden wrote: typeof(OProduct)
typeof(ProductObject)
|
|
|
|
|
|
Hello Coders,
In my Form I have LinkButton, PictureBox. I want to populate the ContextMenu MenuItems Dynamically based on the Control .
for this i need to find at which control mouse pointer is ?
any sounds will be appriciated.
regards
GV Ramana
|
|
|
|
|
Your question, at face value, sounds meaningless. Handle right click on the link button and populate the context menu accordingly (as it should be for the link button), and handle right click for the picturebox, and do the same in its handler. That's it!
But obviously the fact that you have asked the question means that there is more to it than that! So what's more?
Koushik Biswas
|
|
|
|
|
I think he is looking for a generic way, something like Form.KeyPreview is for keys but for the mouse. The only way I think is to use hooks, as this is the only approach I have seen.
|
|
|
|
|
Hi, I have an aspx page that I want to accept 2 files. These two files in turn I wish to be parameter to a C# console App on the same webserver. Whats the best way of going about this? Also the main function Program.cs returns an int depending on results etc, how can I retrieve this? Thanks in advance,
|
|
|
|
|
Hi,
I have been searching for help on this issue since many days.
I have a video on my desktop and it has some properties assgned to it through summary.
this can be done by right clicking the video and going into properties and then to summary tab.
Now the requiremnt is to get these details from c# code .
Any amount of help will be appreciated.
Thanks
Sama
|
|
|
|
|
You need to do a search on extracting the metadata from video files.
|
|
|
|
|
Read this article[^]
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
Hi Mircea,
Thanks a ton for the article.
It helped me in solving a major part of my problem.
But i have seen the the code doesnt work for .mov,etc kinds of files.
my req was to take metadata including comments,keywords from video files.
if you could provide me more help , i would be very grateful to you.
Thanks,
Sama
|
|
|
|