Click here to Skip to main content
15,885,880 members
Home / Discussions / C#
   

C#

 
AnswerRe: Validating textbox value against an excel worksheet and append to datagridview Pin
ZurdoDev28-Aug-19 5:20
professionalZurdoDev28-Aug-19 5:20 
AnswerRe: Validating textbox value against an excel worksheet and append to datagridview Pin
OriginalGriff28-Aug-19 5:23
mveOriginalGriff28-Aug-19 5:23 
GeneralRe: Validating textbox value against an excel worksheet and append to datagridview Pin
BillWoodruff28-Aug-19 18:49
professionalBillWoodruff28-Aug-19 18:49 
AnswerRe: Validating textbox value against an excel worksheet and append to datagridview Pin
BillWoodruff28-Aug-19 18:46
professionalBillWoodruff28-Aug-19 18:46 
GeneralRe: Validating textbox value against an excel worksheet and append to datagridview Pin
Member 1457117728-Aug-19 21:21
Member 1457117728-Aug-19 21:21 
GeneralRe: Validating textbox value against an excel worksheet and append to datagridview Pin
BillWoodruff28-Aug-19 22:57
professionalBillWoodruff28-Aug-19 22:57 
QuestionRead Portion of text from Text File Pin
Member 1398003226-Aug-19 19:39
Member 1398003226-Aug-19 19:39 
AnswerRe: Read Portion of text from Text File Pin
OriginalGriff26-Aug-19 20:27
mveOriginalGriff26-Aug-19 20:27 
Assuming that you want to show a specific part from the last line in the file, you can do it very easily.
There are two basic ways: use Substring, which extracts a specific portion from a string (good if your line format is static and never changes) or use a Regular Expression (good if the data moves around, changes position from line to line).
First, read all the lines:
C#
string[] lines = File.ReadAllLines(@"C:\Text.txt");

You can identify the last line directly from that
C#
string lastLine = lines[lines.Length - 1];

You can then extract the bit you want - I'll use substring:
C#
string bitYouWant = lastLine.Substring(25, 9);

And print it:
C#
Console.WriteLine(bitYouWant);

Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

GeneralRe: Read Portion of text from Text File Pin
Member 1398003226-Aug-19 20:41
Member 1398003226-Aug-19 20:41 
GeneralRe: Read Portion of text from Text File Pin
phil.o26-Aug-19 21:07
professionalphil.o26-Aug-19 21:07 
GeneralRe: Read Portion of text from Text File Pin
Member 1398003226-Aug-19 21:31
Member 1398003226-Aug-19 21:31 
GeneralRe: Read Portion of text from Text File Pin
phil.o26-Aug-19 21:39
professionalphil.o26-Aug-19 21:39 
GeneralRe: Read Portion of text from Text File Pin
Member 1398003226-Aug-19 21:41
Member 1398003226-Aug-19 21:41 
GeneralRe: Read Portion of text from Text File Pin
OriginalGriff26-Aug-19 21:21
mveOriginalGriff26-Aug-19 21:21 
GeneralRe: Read Portion of text from Text File Pin
Member 1398003226-Aug-19 21:37
Member 1398003226-Aug-19 21:37 
GeneralRe: Read Portion of text from Text File Pin
OriginalGriff26-Aug-19 21:48
mveOriginalGriff26-Aug-19 21:48 
AnswerRe: Read Portion of text from Text File Pin
Gerry Schmitz27-Aug-19 5:24
mveGerry Schmitz27-Aug-19 5:24 
SuggestionRe: Read Portion of text from Text File Pin
Richard Deeming27-Aug-19 5:42
mveRichard Deeming27-Aug-19 5:42 
QuestionC# WPF Snip code for Login on AD Azure Problem to find the right code Pin
jan Meeling25-Aug-19 21:56
jan Meeling25-Aug-19 21:56 
AnswerRe: C# WPF Seeds code for Login on AD Azure Pin
phil.o25-Aug-19 22:12
professionalphil.o25-Aug-19 22:12 
GeneralRe: C# WPF Seeds code for Login on AD Azure Pin
#realJSOP26-Aug-19 0:48
mve#realJSOP26-Aug-19 0:48 
GeneralRe: C# WPF Seeds code for Login on AD Azure Pin
phil.o26-Aug-19 0:55
professionalphil.o26-Aug-19 0:55 
GeneralRe: C# WPF Seeds code for Login on AD Azure Pin
jan Meeling26-Aug-19 20:47
jan Meeling26-Aug-19 20:47 
AnswerRe: C# WPF Seeds code for Login on AD Azure Pin
OriginalGriff25-Aug-19 22:16
mveOriginalGriff25-Aug-19 22:16 
GeneralRe: C# WPF Seeds code for Login on AD Azure Pin
jan Meeling26-Aug-19 20:44
jan Meeling26-Aug-19 20:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.