|
XmlDocument doc = new XmlDocument();
string place = String.Format("http://maps.googleapis.com/maps/api/geocode/xml?latlng=13.020164575569374,77.92610049247741&sensor=false");
doc.Load(place);
XmlNode element = doc.SelectSingleNode("//GeocodeResponse/status");
Am getting the XML document from google maps services. but am getting 403 forbidden error. While i copy the link and run in a browser then am getting that XML document which i need. I do have an api key , client ID or signature. I tried eveything in that link. But none worked out. Help me in solving it. thanks in advance.
|
|
|
|
|
Strange. Can you receive it with
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(place);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
etc.?
|
|
|
|
|
Thanks for your reply. I got that error because my proxy was restricting my web request. Now i have bypassed the proxy and got a readable address from latitude and longitude.
|
|
|
|
|
I need to clear a listbox from a class other than the form where it exists. Any idea why this isn't working? I'm getting no error messages when I compile and I am seeing the Console.WriteLine text I also added in the same function. I can call this function from within my form and it behaves as expected. I tried setting the listbox to public despite the fact I wasn't getting protection level errors but that made no difference.
Just to clarify what I'm doing here... I have a form that includes a panel of user controls from another class. So when I selected and item from otherListBox I want to clear the mainListBox in a MyForm. Heres my code:
MyForm
public void ClearMainListBox()
{
Console.WriteLine("echo");
mainListBox.Items.Clear();
}
OtherClass
private void otherListBox_SelectedIndexChanged(object sender, EventArgs e)
{
MyForm mf = new MyForm();
mf.ClearMainListBox();
}
|
|
|
|
|
Your program is behaving exactly as you should expect it to.
doby48 wrote: MyForm mf = new MyForm();
You create a brand new MyForm
doby48 wrote: mf.ClearMainListBox();
Clear the listbox
doby48 wrote: }
Then you let mf go out of scope and be destroyed.
If you really want your OtherClass to do anything with MyForm then you need to pass the existing instance of MyForm to OtherClass. Start with Transferring information between two forms, Part 1: Parent to Child[^]
|
|
|
|
|
I'm actually already doing the Constructor method listed on that page with a couple exceptions. I was mising the
InitializeComponent();<br /> in the child form and I was missing the mf.Show(); in the parent form. I added those couple commands though and still the same result.
|
|
|
|
|
Got it figured out. What I really needed to do was dispose the child form and recreate it which in turn clears the listbox in question. Thanks for the suggestion though.
|
|
|
|
|
hi every one,
I am a beginner programmer in c#.net(windows app) and I want to write a chat application has a database that clients can send offline messages.
what should i do?
modified 6-Jun-14 15:50pm.
|
|
|
|
|
Rather than ask a question in a forum why not do some research into your requirement, do a search of the articles and read through some of them, try Google. This type of application is often used as a teaching aid and there are lots of good examples.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
yes i search in google, but i couldn't find what i want.
|
|
|
|
|
Have some google foo[^]. If you can't get something out of that lot then you need to change your goals in life.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
thanks,i saw some of them before,but others were useful.
|
|
|
|
|
Please do not cross post. I answered your question.
How I Can Write A Chat Application?[^]
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
The question has been closed, not what I would consider and answer!
Still if the guy can't find a decent chat example on the interweb then I give up!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: The question has been closed, not what I would consider and answer! It was closed after I answered it actually.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
We can't provide the source code for big applications like that - We are all volunteers, and most of us have hobbies and interests apart from writing code and answering questions.
I did a little Google search for you, and feel like these two tutorials can help you coming closer to your goal:
TCP/IP Chat Application Using C#[^]
Basic Client-Server Chat Application[^]
The console is a black place
|
|
|
|
|
|
public void Download(string user,string filename, out byte[] file)
{
file = new byte[1];
if (!System.IO.Directory.Exists("Share"))
System.IO.Directory.CreateDirectory("Share");
foreach (string the in System.IO.Directory.GetFiles("Share"))
{
if(the.Contains(filename))
if (System.IO.File.Exists(the))
{
file = System.IO.File.ReadAllBytes(the);
AddLog(string.Format("> File: {0} has been downloaded at {1}. by {2}",(new System.IO.FileInfo(the)).Name,DateTime.Now.ToShortTimeString(),user));
break;
}
}
if (file.Length == 1)
file = null;
}
this is my code.
Anyone can help me convert it? Plzzzz.
|
|
|
|
|
Member 10287915 wrote: Anyone can help me convert it? To what exactly? If you wish to use this with a progress bar then you should check the file size before starting and then read and write in chunks (e.g. each chunk is 5% of the total), so after each chunk you update your progress bar.
|
|
|
|
|
"Convert"?
You mean "extend".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
My English very bad. exactly is extend.
|
|
|
|
|
Have a look at the Application Auto-update via Online Files in C#[^] article.
Within in it I use a progress bar to show the progress of a download from an ftp site.
Have a look at the Bytesdownloaded method within Form1.cs of the Update application if you want to get to the nitty gritty.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Hello Guys,
My Code:
private void button3_Click(object sender, EventArgs e)
{
FileInfo msiFile = new FileInfo(@"C:\temp\WinInstaller\Sample.msi");
WindowsInstaller.Installer inst = (WindowsInstaller.Installer)new Installer();
Database instDb = inst.OpenDatabase(msiFile.FullName, WindowsInstaller.MsiOpenDatabaseMode.msiOpenDatabaseModeTransact);
WindowsInstaller.View view = instDb.OpenView("DELETE FROM `Registry` WHERE `Registry`.`Root`='1'");
view.Execute(null);
view.Close();
instDb.Commit();
}
Am trying to delete a row in "Registry" table in MSI Database:
Registry (s72) Root (i2) Name (L255) Value (L0)
69ADA5050611 1 PATH C:\Program Files\Sample\
Am successfully in deleting the row with the below combination (tired seperatly with every command)
WindowsInstaller.View view = instDb.OpenView("DELETE FROM `Registry` WHERE `Registry`.`Registry`='69ADA5050611'");
WindowsInstaller.View view = instDb.OpenView("DELETE FROM `Registry` WHERE `Registry`.`Name`='PATH'");
WindowsInstaller.View view = instDb.OpenView("DELETE FROM `Registry` WHERE `Registry`.`Value`='C:\Program Files\Sample\'");
But i want to delete the row using "Root" as refernce, am getting error when i use the below command.
WindowsInstaller.View view = instDb.OpenView("DELETE FROM `Registry` WHERE `Registry`.`Root`='1");
I get runtime error for the above line "COMException was unhandled OpenView,Sql"
How to delete the row using Root as reference.
Please suggest.
Cheers,
|
|
|
|
|
Guys, Got the solution, Root column is of i(2).. But am trying to store that as string with quotes '1'
To work, i Should `Registry`.`Root`=1
|
|
|
|
|
Hi I am giving target type as exe and output file name also has extension exe but erro i am getting:
C:\Program Files\Microsoft\ILMerge>ilmerge /target:exe /out:myoutput.exe Utility.exe
FeCom.dll /ndebug /xmldocs /targetplatform:v4
,"%ProgramFiles%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
An exception occurred during merging:
ILMerge.Merge: /target specified as an executable, but output file, 'C:\Program'
, does not have a .exe extension.
at ILMerging.ILMerge.Merge()
at ILMerging.ILMerge.Main(String[] args)
|
|
|
|