|
My bad - I read the question as 'I want to write a c# compiler'... My way was definitely easier! Sarchasm : The gulf between the author of sarcastic wit and the person who doesn't get it.
|
|
|
|
|
OriginalGriff wrote: The next problem: how do you use .NET classes with an non-OOP language like C?
That won't be a problem. How F# is using .NET framework classes? How C++/CLI supports non-OO programing? But it's more work for compiler writers. Best wishes,
Navaneeth
|
|
|
|
|
Hello,
I need help, i want to list a content from specific folder from FTP, a can make the connection to FTP, but i don't know how can list the files contended in a specific Folder from FTP in one ListBox.
I'm new ( beginner) in .NET
I have one folder ftp;//server.com/FolderX/
i want to list the files from FolderX in one ListBox and in one label to show me the numbers of files from FolderX
This is my code in C#
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
FtpWebRequest Request = (FtpWebRequest)WebRequest.Create("ftp://server.com");
Request.Method = WebRequestMethods.Ftp.ListDirectory;
Request.Credentials = new NetworkCredential("user", "pass");
FtpWebResponse Response = (FtpWebResponse)Request.GetResponse();
Stream ResponseStream = Response.GetResponseStream();
StreamReader Reader = new StreamReader(ResponseStream);
//ListBox1.Items.Add(Response.BannerMessage);
//ListBox1.Items.Add(Response.WelcomeMessage);
while (!Reader.EndOfStream)//Read file name
{
ListBox1.Items.Add(Reader.ReadLine().ToString());
}
Response.Close();
ResponseStream.Close();
Reader.Close();
}
}
I try something like "FtpWebRequest Request = (FtpWebRequest)WebRequest.Create("ftp://server.com/FolderX");" but i give error from line "FtpWebResponse Response = (FtpWebResponse)Request.GetResponse();"
Thanks for your time !
|
|
|
|
|
Try here: Simple FTP demo application using C#.Net 2.0[^] If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
how to upload image on ftp server folder in c# full source code ...
|
|
|
|
|
|
Since when was an image not a type of file?
And for your information, always use reply on the message you want to reply to, not your own message - that way the person you want to talk to gets notified.If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
Hi,
I want "Enter" Key press count fro .doc file. I am using ASCII value of "Enter" Key . But How can I find using stramreader while reading file.
When I read file. when ever I press "Enter" it get "" value for "Enter" Key.
but while reading file if it contains "" value then it can be problem so How can I do this??
Or any other Solution for that?
Thanks,
sjs
|
|
|
|
|
If this is a .doc file as in a MS Word document, the probably the easiest and safest way is to use Microsoft.Office.Interop.Word which provides a statistics enumeration, which includes Lines and Paragraphs count[^].
If this is your own .doc format, then we would need to see the code you are using to read it, and possibly the code to write it as well. When pasting, use the "code block" widget to preserve the formatting, and the Preview button to check it.
Bear in mind that the Enter key has no ASCII value, and that ASCII CR is not the same as '\n'.If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
accii value of enter key is 13
|
|
|
|
|
ASCII 13 is not the enter key - it is a CR (or carriage return) character. It indicates that the cursor should move to the left hand side, not that it should start a new line. It may, or may not, be in conjunction with the ASCII LF character depending on the system.
With a .DOC file, there is no guarantee that CR indicates anything, particularly the end of a paragraph as originally requested by the OP. Remember that Word 2007 changed the .DOC file format to an XML based paradigm where CR has no meaning whatsoever! Even before 2007, CR did not delimit a paragraph - see the .DOC file format, available on MSDN for details)You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
what kind protocol are using by socket?
|
|
|
|
|
Ok I have setup a simple gui for uart. I am trying to light up 4 LEDS thru a MC. LED0 will be 0x01, LED 1, 2, 3 will be 2, 4, 8. Will this send out the appropriate command I am looking for. I have no way to test it until tomorrow because I do not have the hardware with me but was wondering if this would suffice. I do not get any errors or warnings so I am thinking it should. Thanks
private void buttonLED0_Click_1(object sender, EventArgs e)
{
Data = Data ^= 0x01;
int BytesToWrite = Data;
int bytes = serialPort1.BytesToWrite;
buttonLED0.Enabled = !buttonLED0.Enabled;
if (buttonLED0.Enabled)
{
pictureBoxLED0.BackgroundImage = imageList1.Images[(int)LEDColor.GreenOn];
}
if (!buttonLED0.Enabled)
{
pictureBoxLED0.BackgroundImage = imageList1.Images[(int)LEDColor.RedOn];
}
}
|
|
|
|
|
By the way this will have to be sent out thru the TXD.
|
|
|
|
|
John-EE wrote: I do not get any errors or warnings so I am thinking it should.
It would be nice if not getting compile time errors or warnings meant that something would work.
The code you provided here doesn't look like it'll send anything out of the serial port. If it did, it would use the SerialPort.Write method. Take a look at msdn for details and examples.Standards are great! Everybody should have one!
|
|
|
|
|
I don't really know what the rest is about, but this is definitely odd:
John-EE wrote: Data = Data ^= 0x01;
This will only do something other than the more usual Data ^= 1 if Data is a property with side effects
|
|
|
|
|
harold aptroot wrote: if Data is a property with side effects
...which we are all really hoping it isn't. If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
I spent one short evening last week defining a library of user controls for my project to track substation electrical equipment. I had found myself duplicating efforts creating various forms that use the same information, and found it tedious to switch back and forth tweaking properties to make the appearance consistent among forms. So I grouped various data items that I was recreating for each form and spent a few hours creating user controls in a library.
For example, a recloser has some basic nameplate information - serial #, manufacturer, type, etc. Reclosers also have a trip coil, and a close coil, and some but not all have ground trip coils. Each coil has its own voltage and current ratings, and a programmable sequence of trip-wait-close steps it can use to restore service on a faulted line. So I made a generic nameplate control, a coil control, and a sequence control. With these new controls I can play with the visibility properties to display only the elements that are relevant to a specific function or recloser type. At least, that was my plan.
Tonight I spent 30 seconds creating a test Form app, referenced my new library, and dragged the controls onto the form. It looks exactly the way I wanted it to, and behaves exactly as planned when I fiddle with the control properties! Now it's time to add controls to describe transformers, load tap changers, regulators, capacitors, and power circuit breakers to the library.
I'm jazzed! In 10+ years wasted trying to do something useful with Visual C++ I never managed to do this much at all, let alone in only a few hours!
Many thanks to all the patient helpers I've discovered here - programming is FUN again! "A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
Did you mean to post this in the C# forum? Seems like it would make a good Lounge post.
|
|
|
|
|
It works either way, and this is where the folks who helped hang out. "A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
I am newbie to webservices
I am trying to learn about them, but got struck in the first place itself. Please help me out.
My service.cs in the web service.
--------------------------------
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://localhost:1458/forumservices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {
}
[WebMethod]
public string welcome(string name)
{
return "Welcome " + name;
}
}
now on a button click from another web page
protected void Button1_Click(object sender, EventArgs e)
{
try
{
soapMessage =
@"
<?xml version=""1.0"" encoding=""utf-8""?>
<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">
<soap12:Body>
<welcome xmlns=""http://localhost:1458/forumservices/"">
<name>Rajas</name>
</welcome>
</soap12:Body>
</soap12:Envelope>";
WebClient mClient = new WebClient();
Response.Write(System.Text.Encoding.ASCII.GetString(mClient.UploadData("http://localhost:1458/forumservices/Service.asmx", "POST", System.Text.Encoding.ASCII.GetBytes(soapMessage))));
}
catch (System.Net.WebException ex)
{
if (ex.Response != null)
{
Stream strm = ex.Response.GetResponseStream();
StreamReader sr = new StreamReader(strm);
Response.Write(sr.ReadToEnd());
}
else
{
Response.Write(ex.InnerException.ToString());
}
}
}
The compilation is fine, but i keep getting some errors as below
"The remote server returned an error: (500) Internal Server Error."
Please help me out
I had posted the exam same thing in ASP.NET forum, but got no replies.Jack Sparrow
--------------------------------------
Defeat is not the worst of failures. Not to have tried is the true failure.
|
|
|
|
|
|
if you wanted to change say textbox1 datasource to be that of checkbox1 datasource how would you go about doing that ? i looked for something like textbox1.datasource but didn't find anything. I know you can set it in properties but i wanted to set it in code if possible..
thanks
|
|
|
|
|
what do you mean by binding a textbox with datasource, you can simpley write textbox.text for binding any value in that.
|
|
|
|
|
well my original idea was that the reason one of my control was not populating correctly was because it was bound to a different binding source but I don't think that is problem at all. i used
textbox.databinding.add("Text",bindingnavigator.bindingsource,"SurrogateNumber"); then of course i get double binding errors when I do that because it is already bound. I don't know I'll figure something out. Kinda strange that the data comes back but that one control only gets the first instance of the filter whenever all the data is there.
Thanks for trying to help though.
|
|
|
|