Click here to Skip to main content
15,918,742 members
Home / Discussions / C#
   

C#

 
QuestionHow can i solve this Error, i dnt know this error from server or due to my code? Pin
Member 1305063910-Mar-17 0:04
Member 1305063910-Mar-17 0:04 
AnswerRe: How can i solve this Error, i dnt know this error from server or due to my code? Pin
OriginalGriff10-Mar-17 0:21
mveOriginalGriff10-Mar-17 0:21 
QuestionRe: How can i solve this Error, i dnt know this error from server or due to my code? Pin
Gerry Schmitz10-Mar-17 5:15
mveGerry Schmitz10-Mar-17 5:15 
QuestionHow to review dotnet code Pin
Tridip Bhattacharjee9-Mar-17 21:52
professionalTridip Bhattacharjee9-Mar-17 21:52 
AnswerRe: How to review dotnet code Pin
Pete O'Hanlon9-Mar-17 22:22
mvePete O'Hanlon9-Mar-17 22:22 
AnswerRe: How to review dotnet code Pin
Gerry Schmitz10-Mar-17 5:25
mveGerry Schmitz10-Mar-17 5:25 
QuestionWhat control can add pictures and text horizontally ? Pin
Member 24584679-Mar-17 19:53
Member 24584679-Mar-17 19:53 
AnswerRe: What control can add pictures and text horizontally ? Pin
Ralf Meier9-Mar-17 21:10
mveRalf Meier9-Mar-17 21:10 
AnswerRe: What control can add pictures and text horizontally ? Pin
xiecsuk10-Mar-17 0:01
xiecsuk10-Mar-17 0:01 
AnswerRe: What control can add pictures and text horizontally ? Pin
Gerry Schmitz10-Mar-17 5:53
mveGerry Schmitz10-Mar-17 5:53 
GeneralRe: What control can add pictures and text horizontally ? Pin
Member 245846712-Mar-17 18:26
Member 245846712-Mar-17 18:26 
GeneralRe: What control can add pictures and text horizontally ? Pin
Pete O'Hanlon12-Mar-17 21:23
mvePete O'Hanlon12-Mar-17 21:23 
GeneralRe: What control can add pictures and text horizontally ? Pin
Eddy Vluggen13-Mar-17 1:51
professionalEddy Vluggen13-Mar-17 1:51 
Questionc# out parameter must be assigned.... I don't see the logic [solved] Pin
User 110609799-Mar-17 8:48
User 110609799-Mar-17 8:48 
AnswerRe: c# out parameter must be assigned.... I don't see the logic Pin
Richard Deeming9-Mar-17 10:35
mveRichard Deeming9-Mar-17 10:35 
GeneralRe: c# out parameter must be assigned.... I don't see the logic Pin
User 110609799-Mar-17 10:38
User 110609799-Mar-17 10:38 
GeneralRe: c# out parameter must be assigned.... I don't see the logic Pin
User 110609799-Mar-17 20:28
User 110609799-Mar-17 20:28 
AnswerRe: c# out parameter must be assigned.... I don't see the logic Pin
Ralf Meier9-Mar-17 21:14
mveRalf Meier9-Mar-17 21:14 
GeneralRe: c# out parameter must be assigned.... I don't see the logic Pin
Richard MacCutchan9-Mar-17 21:19
mveRichard MacCutchan9-Mar-17 21:19 
GeneralRe: c# out parameter must be assigned.... I don't see the logic Pin
Pete O'Hanlon9-Mar-17 21:21
mvePete O'Hanlon9-Mar-17 21:21 
GeneralRe: c# out parameter must be assigned.... I don't see the logic Pin
User 1106097910-Mar-17 9:26
User 1106097910-Mar-17 9:26 
GeneralRe: c# out parameter must be assigned.... I don't see the logic Pin
Pete O'Hanlon10-Mar-17 10:41
mvePete O'Hanlon10-Mar-17 10:41 
GeneralRe: c# out parameter must be assigned.... I don't see the logic Pin
User 1106097910-Mar-17 10:47
User 1106097910-Mar-17 10:47 
GeneralRe: c# out parameter must be assigned.... I don't see the logic Pin
Eddy Vluggen10-Mar-17 12:23
professionalEddy Vluggen10-Mar-17 12:23 
QuestionCounter not updating file Pin
xiecsuk9-Mar-17 5:34
xiecsuk9-Mar-17 5:34 
I have created the following code
C#
var filename = "wwwroot/Counter/Counter.txt";
var counterStream = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
var reader = new StreamReader(counterStream);
var visits = Convert.ToInt32(reader.ReadLine());
visits = visits + 1;
var writer = new StreamWriter(counterStream);
writer.Write(visits);
counterStream.Dispose();
As you will realise, it is a counter for a website I am building. I am OK down to the line.
C#
visits = visits + 1
Visits does contain one more than is originally stored in Counter.txt. However, the last three lines are not writing anything back to the file. I was expecting it to write a new line in the file, although obviously I want it to replace the original finally. I am at a loss as to why it hasn't. Could someone point me in the right direction, please.

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.