|
Can I ask what the point in the final 3 lines are below?
Matjaž Grahek wrote: string pot = @Application.StartupPath + @"\" + lstFILES.SelectedItem;
StreamReader sr = new StreamReader(pot);
string tempF = sr.ReadToEnd();
sr.Close();
Seems a bit of a WTF to me.
|
|
|
|
|
Bah... it IS WTF but its easier for my understanding... dont even bother with this.
Programming is cool because of this - you have soooooo many different ways to make a program work.
Regards,
Matjaž
|
|
|
|
|
Just Split() the string on the char you want to count, the count will be the number of resulting array elements minus 1 (have to escape the backslash as '\\' ). Most likely your results were thrown off by the escaping of special characters in the text (CRLF becomes \r\n , TAB becomes \t , etc.) and perhaps it brought them over into the char[] in that manner. Either way, this will do the trick:
public void DoYourThingBaby()
{
string pot = @Application.StartupPath + @"\" + lstFILES.SelectedItem;
if(!System.IO.File.Exists(pot))
return;
int count = System.IO.File.ReadAllText(pot).Split('\\').Length - 1
}
Keep It Simple Stupid! (KISS)
|
|
|
|
|
You can use LINQ to accomplish the same thing in a more expressive manner:
int bkslashCount = 0;
string pot = Path.Combine(Application.StartupPath, lstFILES.SelectedItem);
if (File.Exists(pot))
{
string data = File.ReadAllText(pot);
bkslashCount = data.ToCharArray().Where(c => c == '/').Count();
}
|
|
|
|
|
Hi,
probably a lot cheaper is count=str.Length-str.Replace("\\","").Length;
|
|
|
|
|
hey ppl, am developing an excel com add-in using c# and displaying certain data over excel sheets. How can i make a cell or a range of cells or some arbitrary cells "read-only" using c# code?!
|
|
|
|
|
There is no "ReadOnly" attribute for cells or worksheets. You have to do this the exact same way you would if youwere to do it in Excel itself. Turn on the "Locked" property of the cell, then call the method to protect the worksheet to turn on all the protection. I don't the exact code or classes/methods to use since I don't normally do Office interop.
|
|
|
|
|
Erm, i know this process, but was not finding a way to protect my active sheet. It would be gr8 to get the exact code to do so.
Thanks.
|
|
|
|
|
A little Googling found this[^].
|
|
|
|
|
I did try it before but, I want the remaining cells to remain unlocked!!where as this is protecting my entire sheet. I want for example, only my active cell to be made readonly. what has to be done then?
|
|
|
|
|
All cells, by default, have Protection turned on. You have to specifically unprotect the cells you went to remain active when the sheet protection is turned on.
|
|
|
|
|
I am implementing programmable keyboard with credit card facilities.
I want to help to implement the credit card recognition part and how to work with bank with the keyboard that i currently implementing.
If you know how do i start it. Please help me.
Source code or by providing references.
My email gayanfit6@gmail.com
Thank million.
with regards.
Gayan.
|
|
|
|
|
Hi,
I don't know which Programable keybord are you using. Anyway you may need to contact Third Party service to processes any Credit Card/Debit Card. Normally Bank will not allow directly to process any Credit Card/Debit card to the End User (Like you). Hope it may help.
Thanks
Ali Zishan
London
|
|
|
|
|
I am implementing programmable keyboard with credit card facilities.
I want to help to implement the credit card recognition part and how to work with bank with the keyboard that i currently implementing.
If you know how do i start it. Please help me.
Source code or by providing references.
My email fun2021@gmail.com
Thank million.
with regards.
Gayan.
|
|
|
|
|
I would imagine you need to talk to the merchant account providers, and card reader hardware vendors.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
do credit card companies hire just anyone these days? No clue where to even start?
I'd imagine that credit card companies have strict regulations as per project secrecy and whatnot, if you indeed have a job with them, you shouldn't post about it on public forums, nor any part of the coding.
Don't they do their work in java anyways?
Here is some nice articles[^] about credit cards, validation and verification through our very own CP.
|
|
|
|
|
he's probably not working for a CC company directly. Some banks have came up with the brillant idea of using onscreen keyboards for password input to try and beat keystroke loggers (which promptly updated themselves to read the clicks of the virtual keyboard ). My guess would be that some PHB's dediced it would be a good idea to use the same clubuttic idea for CC number input.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Stupidity over security. You've got to be shitting me. Why not just remove spyware... sometimes, ideas like this make my head hurt.
|
|
|
|
|
PHB bank can't make Joe Moron install antivirus, etc. software on his own computer.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
PHB bank shouldn't employ Joe Moron.
|
|
|
|
|
Joe Moron isn't a PHBbank employee, he's a customer. Any general purpose business that only dealt with clueful people wouldn't be able maintain a large enough customer base to survive.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
How can i use yahoo group api like YMass for searching and finding there email id's.
|
|
|
|
|
I am also Searching the same
sorry i can't help you
wait for someone
|
|
|
|
|
Hello,
I would like to check if anyone can help me fix the error in a smart client application downloaded from Microsoft site. The application can be downloaded from:
http://msdn.microsoft.com/en-us/library/ms268995.aspx
I am using the c# version and I am getting the error "Object reference not set to an instance of an object". Its in line 56 on the file CatalogSheet.vb
Here is the exact line content:
Globals.ThisWorkbook.CategorySelector.SetCategoriesDataBinding(_
categoriesBindingSource, "CategoryName", "CategoryID");
Thank you in advance to anyone who can help me.
|
|
|
|
|
If you put a breakpoint on this line and then hover over the variables when you reach it, one of them will be set to null. This is the one that is failing - hint start at Globals and work from there - I'm going to guess that it's either ThisWorkbook or categoriesBindingSource that is null.
|
|
|
|