Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
This is my code (.Net 4):
string dName = textBox1.Text + ".db";
string fExist = #"C:\word_app\" + dName;
if (!File.Exists(fExist))
{
MessageBox.Show("file doesnt exist");
}
Even if I have the file in that location , this messagebox will appear.
you have just to correct your path (its words not word)
string dName = textBox1.Text + ".db";
string fExist = #"C:\words_app\" + dName;
if (!File.Exists(fExist))
{
MessageBox.Show("file doesnt exist");
}
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 11 months ago.
Improve this question
Here is my code
RegistryKey = regsohr;
regsohr = Registry.LocalMachine.OpenSubKey(#"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{DFDC1B83-7FD3-4C77-8CD1-7391D1680ACA}");
sw.WriteLine(regsohr.GetValue("Path"));
It can't get into {DFDC1B83-7FD3-4C77-8CD1-7391D1680ACA}.
But when I delete that line everything works fine.
Anyone has any ideas why it can't open this SubKey?
I will appreciate any help.
My bad.
I have messed up with "HKEY_LOCAL_MACHINE".
regsohr = Registry.LocalMachine.OpenSubKey(#"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{DFDC1B83-7FD3-4C77-8CD1-7391D1680ACA}");
Fixed it
regsohr = Registry.LocalMachine.OpenSubKey(#"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{DFDC1B83-7FD3-4C77-8CD1-7391D1680ACA}");
Try this , for example i put it in a Label to check if it works
{
string readValue;
readValue = My.Computer.Registry.GetValue
(#"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache", "Tasks",Nothing);
Label6.Text = readValue;
}
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 5 years ago.
Improve this question
public string ReplaceTest(int i)
{
string rep = this.textBox3.Text;
string reped = rep.Replace("sir, this.textBox3.Text");
}
Like this? this is what i want to do but another error comes up not all code paths return a value
string.Replace() takes two arguments:
the string to replace
the string to use instead
If you want to remove "sir", it means to replace it with an empty string:
string reped = rep.Replace("sir", string.Empty);
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I want to write
Label "BuildingData" does not exist.
I know how to write using String.format and stringbuilder. I want to write this using String.Concat.
When I write code
String.Concat("Label ","\"","BuildingData","\"", "does not exist.")
The output is
Label \"BuildingData\" does not exist.
Add a space before does and you'll get the correct output. The quotes are a red herring - you're looking in the debugger.
using System;
public class Test
{
public static void Main()
{
var concat = String.Concat("Label ","\"","BuildingData","\"", " does not exist.");
Console.WriteLine(concat);
}
}
Here's the output.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
My code
string userid;
string userimageid;
bitmap.save(#"C:\temper\temp\"+userid+"\"+userimageid+".jpg");
get build error! why canĀ“t I create subfolder with string value name and insert image? still cant insert to that crated folder as name userid.
Yes, you can. But you must create first the folder and then save the bitmap:
string folderName = #"C:\temper\temp\"+userid;
if (!Directory.Exists(folderName) {
Directory.CreateDirectory(folderName);
}
bitmap.save(folderName + "\\userimage.jpg"); //your original concatenation had an error
Solved!
string folderName = #"C:\temper\temp\"+userid;
if (!Directory.Exists(folderName) {
Directory.CreateDirectory(folderName);
}
bitmap.save(folderName + "\\" +userimage+ ".jpg"); `Create first folder and save Thanks Mnieto`
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I can find a lot of info about parsing but I would like to put them together. I am trying to get the City, State, and Zip and place them in a single Label on a winform like 'City, State Zip' here is what I have gotten to but they will not get together.
while (sqlDataReader.Read())
{
label_vendor_Address.Text = sqlDataReader["Vendor_Address"].ToString();
string vendor_City = sqlDataReader["Vendor_City"].ToString();
string vendor_State_Prov = sqlDataReader["Vendor_State_Prov"].ToString();
string vendor_Zip_Country_Code = sqlDataReader["Vendor_Zip_Country_Code"].ToString();
label_vendor_City_State_Zip.Text = vendor_City, vendor_State_Prov, vendor_Zip_Country_Code;
}
I am sure that I am missing something very simple. Help is gratefully appreciated.
Is it as simple as this:
label_vendor_City_State_Zip.Text = vendor_City + ", " + vendor_State_Prov + " " + vendor_Zip_Country_Code;
Surely, not though, as your code would not compile. Can you provide code that can compile?