This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I have a Scintilla control that I create in C#, and the syntax highlighting doesn't work. It sets the font correctly which tells me that the file is being loaded, but the syntax highlighting doesn't work at all:
Scintilla r = new Scintilla();
r.Dock = DockStyle.Fill;
r.ConfigurationManager.IsUserEnabled = true;
r.ConfigurationManager.CustomLocation = "langs.xml";
r.ConfigurationManager.Language = "rb";
r.Margins[0].Width = 40;
r.Indentation.UseTabs = true;
r.Indentation.IndentWidth = 4;
r.Indentation.ShowGuides = true;
r.Indentation.TabIndents = true;
r.Indentation.TabWidth = 4;
r.Indentation.SmartIndentType = SmartIndent.Simple;
and the configuration file is this:
http://codepad.org/DAjCrlPT
in langs.xml. (The code won't fit here.) Can someone tell me why this is not working?
Nevermind, my config file was wrong for some reason.
Related
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I want to compile a code with codedom which should connect to my ftp server.
But I cant type in the credentials because of the ""...
Look here :
Temp.AppendLine(#"request.Credentials = new NetworkCredential("userid","userpassword");");
If I type " in the code, it automatic ends the content of the brackets...
Help?
You may need to escape the content by using double quotes, like this:
Temp.AppendLine(#"request.Credentials = new NetworkCredential(""userid"",""userpassword"");");
Temp.AppendLine(#"request.Credentials = new NetworkCredential(""userid"",""userpassword"");");
Escape the " with ""
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
The code:
'Files' is a List<string> and _indx is an int.
label22.Text = files[_indx];
For example in 'files' in index[0] I have this string:
D:\New folder (45)\converted.avi_Automatic\Lightning 0 Length 2 [91 - 93]\000091.bmp
But instead in label22.Text I want it to show me only '000091.bmp' without the rest of the directory path.
How can I do it ?
Use Path.GetFileName:
label22.Text = Path.GetFileName(files[_indx]);
I believe you are looking for Path.GetFileName():
label22.Text = Path.GetFileName(files[_indx]);
Path.GetFileName(fileName) returns the file name without the directory.
taken from http://msdn.microsoft.com/en-us/library/system.io.path.getfilename(v=vs.100).aspx
The simplest way is
Path.GetFileName(files[_indx]);
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
this is part of my program code for a piglatin translation, so I create a punctuation for my sentence but when i compile it shows the extra place within the sentence. so I do this:
private bool isPunctuation(string noo)
{
int pos = 1;
string punctuation = ",.!?";
pos = punctuation.IndexOf(' ');
while (pos >= 0)
{
pos = punctuation.IndexOf(' ', pos + 1);
//return false;
}
return true;
}
it still show the extra space. what do i need change in this code?
It's not clear how you're trying to use your method anyway, but:
Your method never uses its input (noo)
This code:
string punctuation = ",.!?";
pos = punctuation.IndexOf(' ');
... will always leave pos as -1, as ",.!?" doesn't contain a space
Your method could only exit either via an exception or by returning true; there's no way it can ever return false, as the return false; statement is commented out. (With it uncommented, you've then got a pretty odd while loop...) How were you intending to use it?
Fundamentally, it seems to me that you need to take a step back. Think about why you wanted such a method (it's unclear what it has to do with the replacing part of the question title) and exactly how it should behave.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I'm trying to save a file to the server and then load into a reader for it to be downloaded. However, I am getting a FileNotFoundExeption. I save to the exact same path, manually open the directory and can see the file there. However, reading it results in the exception. This is my first time trying his - am I doing something wrong?
try
{
using (StreamReader reader = new
StreamReader(HttpContext.Current.Server.MapPath(#"~/Downloads/data.text")))
{
// do something
}
}
catch (Exception)
{
}
Double-check the file name! In one of your comments you used the file name data.txt and not the name data.text. I suppose it's just a typo in your code.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
Currently, not even the simplest examples of using the 'ExpandoObject' work on my machine.
Both
dynamic obj = new ExpandoObject();
obj.Value = 10;
var action = new Action<string>((line) => Console.WriteLine(line));
obj.WriteNow = action;
obj.WriteNow(obj.Value.ToString());
(from this website) and
dynamic sampleObject = new ExpandoObject();
sampleObject.test = "Dynamic Property";
Console.WriteLine(sampleObject.test);
(from the MSDN examples) fail with a RuntimeBinderException. I presume I've misconfigured something, but I am at a loss about what it might be.
I am using .NET v4.0.30319 and Visual Studio 2010 SP1 Premium. Please ask for anything else you might need to know. =)
Deleting the hidden "SolutionName.suo" file in the solution directory fixed this problem for me.
I still have no clue why it occured, though.
Edit:
Andras Zoltan, who deleted his answer, guessed correctly. I have had "Break on all Exceptions" enabled and was being stupid. =)
The problem is simply that Console.WriteLine has too many overloads and so the dynamic part cannot be figured out correctly.
Put the output into a typed variable before or just cast it.
e.g.
dynamic sampleObject = new ExpandoObject();
sampleObject.test = "Dynamic Property";
Console.WriteLine((string)sampleObject.test);