when the text in a textbox is equal to a certain word i need to value in the combo box to be saved for that textGridview - Add Row Button Using FooterReportviewer Errorprgress bar when proccessing update application VB NETSend Bulk Email in VB.NET Reciepients Emails will uploaded by excelHow to set limit values textbox and show message box when reached maximum limit VB.Nethow to insert checked items from checkedlistbox to SQL database?How do I run CMD.exe as administratorChanging background color using combobox from a different form in Visual BasicConvert listbox to DataGridViewI need help my CMD working not the same result
What evidence points to a long ō in the first syllable of nōscō's present-tense form?
Attacking the Hydra
Why are electric shavers specifically permitted under FAR §91.21
Escape Velocity - Won't the orbital path just become larger with higher initial velocity?
Setting up a Mathematical Institute of Refereeing?
Heyawake: An Introductory Puzzle
What are the advantages of this gold finger shape?
What should we do with manuals from the 80s?
Does the C++ standard guarantee that a failed insertion into an associative container will not modify the rvalue-reference argument?
Did Michelle Obama have a staff of 23; and Melania have a staff of 4?
How can I find files in directories listed in a file?
Do I need to start off my book by describing the character's "normal world"?
Is there a word for returning to unpreparedness?
Did Pope Urban II issue the papal bull "terra nullius" in 1095?
What would it take to get a message to another star?
Help, I cannot decide when to start the story
Sum Square Difference, which way is more Pythonic?
What is the most difficult concept to grasp in Calculus 1?
Units of measurement, especially length, when body parts vary in size among races
Are there any cons in using rounded corners for bar graphs?
How would armour (and combat) change if the fighter didn't need to actually wear it?
What is the hottest thing in the universe?
Is it really Security Misconfiguration to show a version number?
Why did IBM make the PC BIOS source code public?
when the text in a textbox is equal to a certain word i need to value in the combo box to be saved for that text
Gridview - Add Row Button Using FooterReportviewer Errorprgress bar when proccessing update application VB NETSend Bulk Email in VB.NET Reciepients Emails will uploaded by excelHow to set limit values textbox and show message box when reached maximum limit VB.Nethow to insert checked items from checkedlistbox to SQL database?How do I run CMD.exe as administratorChanging background color using combobox from a different form in Visual BasicConvert listbox to DataGridViewI need help my CMD working not the same result
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have orders in text files in the debug folder and when i type the name of the order in a text box it displays the order is a list box and there is a combo box underneath where i can change the status of the meal preparation (Being prepared, ready to deliver etc,). If i go back to that form and type in the same order name into the textbox i need to previous prepartion status to be already in the textbox. Thanks for any help!
Public Class frmOrderStatus
Private Sub btnStatus_Click(sender As Object, e As EventArgs) Handles btnStatus.Click
Dim sr As IO.StreamReader = IO.File.OpenText(strTxtOrderNum & ".txt")
Do Until sr.EndOfStream
lstOrder.Items.Add(sr.ReadLine)
Loop
End Sub
Private Sub OrderStatus_Load(sender As Object, e As EventArgs) Handles MyBase.Load
lstOrder.Items.Clear()
btnStatus.Enabled = False
ChangeStatus.Enabled = False
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnValidate.Click
strTxtOrderNum = txtOrderNum2.Text
btnStatus.Enabled = True
ChangeStatus.Enabled = True
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
strSaveStatus = ChangeStatus.SelectedIndex
End Sub
Private Sub ChangeStatus_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ChangeStatus.SelectedIndexChanged
End Sub
End Class
vb.net
add a comment |
I have orders in text files in the debug folder and when i type the name of the order in a text box it displays the order is a list box and there is a combo box underneath where i can change the status of the meal preparation (Being prepared, ready to deliver etc,). If i go back to that form and type in the same order name into the textbox i need to previous prepartion status to be already in the textbox. Thanks for any help!
Public Class frmOrderStatus
Private Sub btnStatus_Click(sender As Object, e As EventArgs) Handles btnStatus.Click
Dim sr As IO.StreamReader = IO.File.OpenText(strTxtOrderNum & ".txt")
Do Until sr.EndOfStream
lstOrder.Items.Add(sr.ReadLine)
Loop
End Sub
Private Sub OrderStatus_Load(sender As Object, e As EventArgs) Handles MyBase.Load
lstOrder.Items.Clear()
btnStatus.Enabled = False
ChangeStatus.Enabled = False
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnValidate.Click
strTxtOrderNum = txtOrderNum2.Text
btnStatus.Enabled = True
ChangeStatus.Enabled = True
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
strSaveStatus = ChangeStatus.SelectedIndex
End Sub
Private Sub ChangeStatus_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ChangeStatus.SelectedIndexChanged
End Sub
End Class
vb.net
Are you storing each order in a separate file?
– Mary
Mar 27 at 21:46
yea each order is in a sererate file but when i'm trying to append the text in the textfile to add more text. The order opens in a list box but when i try to append the text it doesn't recognise the file name
– Sean Dolan
Mar 28 at 12:17
This is the code im trying to use ``` Dim swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt") swVar.WriteLine(strSelectedItem) swVar.Close()```
– Sean Dolan
Mar 28 at 12:18
add a comment |
I have orders in text files in the debug folder and when i type the name of the order in a text box it displays the order is a list box and there is a combo box underneath where i can change the status of the meal preparation (Being prepared, ready to deliver etc,). If i go back to that form and type in the same order name into the textbox i need to previous prepartion status to be already in the textbox. Thanks for any help!
Public Class frmOrderStatus
Private Sub btnStatus_Click(sender As Object, e As EventArgs) Handles btnStatus.Click
Dim sr As IO.StreamReader = IO.File.OpenText(strTxtOrderNum & ".txt")
Do Until sr.EndOfStream
lstOrder.Items.Add(sr.ReadLine)
Loop
End Sub
Private Sub OrderStatus_Load(sender As Object, e As EventArgs) Handles MyBase.Load
lstOrder.Items.Clear()
btnStatus.Enabled = False
ChangeStatus.Enabled = False
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnValidate.Click
strTxtOrderNum = txtOrderNum2.Text
btnStatus.Enabled = True
ChangeStatus.Enabled = True
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
strSaveStatus = ChangeStatus.SelectedIndex
End Sub
Private Sub ChangeStatus_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ChangeStatus.SelectedIndexChanged
End Sub
End Class
vb.net
I have orders in text files in the debug folder and when i type the name of the order in a text box it displays the order is a list box and there is a combo box underneath where i can change the status of the meal preparation (Being prepared, ready to deliver etc,). If i go back to that form and type in the same order name into the textbox i need to previous prepartion status to be already in the textbox. Thanks for any help!
Public Class frmOrderStatus
Private Sub btnStatus_Click(sender As Object, e As EventArgs) Handles btnStatus.Click
Dim sr As IO.StreamReader = IO.File.OpenText(strTxtOrderNum & ".txt")
Do Until sr.EndOfStream
lstOrder.Items.Add(sr.ReadLine)
Loop
End Sub
Private Sub OrderStatus_Load(sender As Object, e As EventArgs) Handles MyBase.Load
lstOrder.Items.Clear()
btnStatus.Enabled = False
ChangeStatus.Enabled = False
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnValidate.Click
strTxtOrderNum = txtOrderNum2.Text
btnStatus.Enabled = True
ChangeStatus.Enabled = True
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
strSaveStatus = ChangeStatus.SelectedIndex
End Sub
Private Sub ChangeStatus_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ChangeStatus.SelectedIndexChanged
End Sub
End Class
vb.net
vb.net
asked Mar 27 at 11:53
Sean DolanSean Dolan
63 bronze badges
63 bronze badges
Are you storing each order in a separate file?
– Mary
Mar 27 at 21:46
yea each order is in a sererate file but when i'm trying to append the text in the textfile to add more text. The order opens in a list box but when i try to append the text it doesn't recognise the file name
– Sean Dolan
Mar 28 at 12:17
This is the code im trying to use ``` Dim swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt") swVar.WriteLine(strSelectedItem) swVar.Close()```
– Sean Dolan
Mar 28 at 12:18
add a comment |
Are you storing each order in a separate file?
– Mary
Mar 27 at 21:46
yea each order is in a sererate file but when i'm trying to append the text in the textfile to add more text. The order opens in a list box but when i try to append the text it doesn't recognise the file name
– Sean Dolan
Mar 28 at 12:17
This is the code im trying to use ``` Dim swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt") swVar.WriteLine(strSelectedItem) swVar.Close()```
– Sean Dolan
Mar 28 at 12:18
Are you storing each order in a separate file?
– Mary
Mar 27 at 21:46
Are you storing each order in a separate file?
– Mary
Mar 27 at 21:46
yea each order is in a sererate file but when i'm trying to append the text in the textfile to add more text. The order opens in a list box but when i try to append the text it doesn't recognise the file name
– Sean Dolan
Mar 28 at 12:17
yea each order is in a sererate file but when i'm trying to append the text in the textfile to add more text. The order opens in a list box but when i try to append the text it doesn't recognise the file name
– Sean Dolan
Mar 28 at 12:17
This is the code im trying to use ``` Dim swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt") swVar.WriteLine(strSelectedItem) swVar.Close()```
– Sean Dolan
Mar 28 at 12:18
This is the code im trying to use ``` Dim swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt") swVar.WriteLine(strSelectedItem) swVar.Close()```
– Sean Dolan
Mar 28 at 12:18
add a comment |
1 Answer
1
active
oldest
votes
It recognizes the file; it just tells you it is in use. A Stream must be closed and disposed. I don't see the StreamReader
even being closed let alone disposed. A `Using...End Using block will close and dispose of objects even if there is an error.
I just used a text file I happened to have to test.
Private strTxtOrderNum As String = "host"
Private Sub ReadFile()
Using sr As IO.StreamReader = IO.File.OpenText(strTxtOrderNum & ".txt")
Do Until sr.EndOfStream
ListBox1.Items.Add(sr.ReadLine)
Loop
End Using
End Sub
Private Sub WriteFile()
Dim strSelectedItem = ComboBox1.Text
Using swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt")
swVar.WriteLine(strSelectedItem)
End Using
End Sub
thanks very much, had to completely change everything but got it working in the end
– Sean Dolan
Mar 28 at 20:11
I my answer lead you to a solution please accept it by clicking the check mark (tick mark) to the left of the answer.
– Mary
Mar 28 at 20:16
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55376555%2fwhen-the-text-in-a-textbox-is-equal-to-a-certain-word-i-need-to-value-in-the-com%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It recognizes the file; it just tells you it is in use. A Stream must be closed and disposed. I don't see the StreamReader
even being closed let alone disposed. A `Using...End Using block will close and dispose of objects even if there is an error.
I just used a text file I happened to have to test.
Private strTxtOrderNum As String = "host"
Private Sub ReadFile()
Using sr As IO.StreamReader = IO.File.OpenText(strTxtOrderNum & ".txt")
Do Until sr.EndOfStream
ListBox1.Items.Add(sr.ReadLine)
Loop
End Using
End Sub
Private Sub WriteFile()
Dim strSelectedItem = ComboBox1.Text
Using swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt")
swVar.WriteLine(strSelectedItem)
End Using
End Sub
thanks very much, had to completely change everything but got it working in the end
– Sean Dolan
Mar 28 at 20:11
I my answer lead you to a solution please accept it by clicking the check mark (tick mark) to the left of the answer.
– Mary
Mar 28 at 20:16
add a comment |
It recognizes the file; it just tells you it is in use. A Stream must be closed and disposed. I don't see the StreamReader
even being closed let alone disposed. A `Using...End Using block will close and dispose of objects even if there is an error.
I just used a text file I happened to have to test.
Private strTxtOrderNum As String = "host"
Private Sub ReadFile()
Using sr As IO.StreamReader = IO.File.OpenText(strTxtOrderNum & ".txt")
Do Until sr.EndOfStream
ListBox1.Items.Add(sr.ReadLine)
Loop
End Using
End Sub
Private Sub WriteFile()
Dim strSelectedItem = ComboBox1.Text
Using swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt")
swVar.WriteLine(strSelectedItem)
End Using
End Sub
thanks very much, had to completely change everything but got it working in the end
– Sean Dolan
Mar 28 at 20:11
I my answer lead you to a solution please accept it by clicking the check mark (tick mark) to the left of the answer.
– Mary
Mar 28 at 20:16
add a comment |
It recognizes the file; it just tells you it is in use. A Stream must be closed and disposed. I don't see the StreamReader
even being closed let alone disposed. A `Using...End Using block will close and dispose of objects even if there is an error.
I just used a text file I happened to have to test.
Private strTxtOrderNum As String = "host"
Private Sub ReadFile()
Using sr As IO.StreamReader = IO.File.OpenText(strTxtOrderNum & ".txt")
Do Until sr.EndOfStream
ListBox1.Items.Add(sr.ReadLine)
Loop
End Using
End Sub
Private Sub WriteFile()
Dim strSelectedItem = ComboBox1.Text
Using swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt")
swVar.WriteLine(strSelectedItem)
End Using
End Sub
It recognizes the file; it just tells you it is in use. A Stream must be closed and disposed. I don't see the StreamReader
even being closed let alone disposed. A `Using...End Using block will close and dispose of objects even if there is an error.
I just used a text file I happened to have to test.
Private strTxtOrderNum As String = "host"
Private Sub ReadFile()
Using sr As IO.StreamReader = IO.File.OpenText(strTxtOrderNum & ".txt")
Do Until sr.EndOfStream
ListBox1.Items.Add(sr.ReadLine)
Loop
End Using
End Sub
Private Sub WriteFile()
Dim strSelectedItem = ComboBox1.Text
Using swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt")
swVar.WriteLine(strSelectedItem)
End Using
End Sub
answered Mar 28 at 15:57
MaryMary
5,1582 gold badges11 silver badges22 bronze badges
5,1582 gold badges11 silver badges22 bronze badges
thanks very much, had to completely change everything but got it working in the end
– Sean Dolan
Mar 28 at 20:11
I my answer lead you to a solution please accept it by clicking the check mark (tick mark) to the left of the answer.
– Mary
Mar 28 at 20:16
add a comment |
thanks very much, had to completely change everything but got it working in the end
– Sean Dolan
Mar 28 at 20:11
I my answer lead you to a solution please accept it by clicking the check mark (tick mark) to the left of the answer.
– Mary
Mar 28 at 20:16
thanks very much, had to completely change everything but got it working in the end
– Sean Dolan
Mar 28 at 20:11
thanks very much, had to completely change everything but got it working in the end
– Sean Dolan
Mar 28 at 20:11
I my answer lead you to a solution please accept it by clicking the check mark (tick mark) to the left of the answer.
– Mary
Mar 28 at 20:16
I my answer lead you to a solution please accept it by clicking the check mark (tick mark) to the left of the answer.
– Mary
Mar 28 at 20:16
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55376555%2fwhen-the-text-in-a-textbox-is-equal-to-a-certain-word-i-need-to-value-in-the-com%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you storing each order in a separate file?
– Mary
Mar 27 at 21:46
yea each order is in a sererate file but when i'm trying to append the text in the textfile to add more text. The order opens in a list box but when i try to append the text it doesn't recognise the file name
– Sean Dolan
Mar 28 at 12:17
This is the code im trying to use ``` Dim swVar As IO.StreamWriter = IO.File.AppendText(strTxtOrderNum & ".txt") swVar.WriteLine(strSelectedItem) swVar.Close()```
– Sean Dolan
Mar 28 at 12:18