Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Read from textfile and fill in textbox

private void Form1_Load(object sender, EventArgs e)
{
    string line = "";
    System.IO.StreamReader file = new System.IO.StreamReader(@"FilePathWithNameAndExtension");
    while (!file.EndOfStream)
    {
        line += file.ReadLine() + "&"; //adding distinct value so that we can split them as a line.
    }
    string[] newLines = line.Split('&'); //storing lines in array.
    txtUserName.Text = newLines[1].Split(':')[1].ToString(); //newLines[1] represent to UserName that means we will extract from second line which is storing the username.
    txtCountry.Text = newLines[2].Split(':')[1].ToString();
    txtMemberShip.Text = newLines[3].Split(':')[1].ToString();
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: flutterwave c# api integration 
Csharp :: c sharp while statement 
Csharp :: ow-to-return-http-500-from-asp-net-core-rc2-web-api 
Csharp :: c# url relative path remove 
Csharp :: unity predicts rigidbody position in x seconds 
Csharp :: how to define a static color resource in xaml wpf 
Csharp :: c# validate username and password 
Csharp :: get first and last item list c# 
Csharp :: c# bitwise or 
Csharp :: C# today, yesterday, last week, last month 
Csharp :: c# Search specified string inside textbox 
Csharp :: universities in greece 
Csharp :: prime number generator 
Csharp :: unity c# bool to int conversion 
Csharp :: c# Add or Concatenate Strings In C# 
Csharp :: app rating within game in unity 
Csharp :: c# write line variable 
Csharp :: c# async in wpf 
Csharp :: get selected rows gridcontrol devexpress 
Csharp :: width="331" height="331" 
Csharp :: c# todatatable nullable 
Html :: trademark symbol 
Html :: espacio html 
Html :: how to submit a form with submit button outside form 
Html :: html disable drag image 
Html :: email anchor tag 
Html :: no history input html 
Html :: html video hide controls 
Html :: html change viewport to smartphone size 
Html :: how to move all html files from one directory to other using python 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =