|
Besides what Christian said, as the default selected value is no, why not just submit the form directly if you want the value to be no?
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi Guys
Thanks for the replies. The default value is "Yes".
When I run the line of code which attempts to set the value to "No" the drop down goes blank. This is not an option when you manually click it. When the form is submitted it must revert to the default "Yes" due to it being blank.
Thanks
|
|
|
|
|
OK, so your code plain doesn't work at all. In that case, why didn't you say so ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
What? If you read my first post, you would see it does work if I am changing the value from "no" to "yes".
Why are you trying to be smug and cheeky?
|
|
|
|
|
Anyway...
How about using the index (If "Yes" = 0 and "No"= 1 or something) instead of the literal values ?
My advice is free, and you may get what you paid for.
|
|
|
|
|
Hi Johan
I tried using the 0 and 1 values, but this dosn't work either. Thanks for your suggestion though
|
|
|
|
|
I would try the values 1 and 2 instead.
|
|
|
|
|
I get this error and I'm not sure why. I am trying to parse a tab seperated file. The first 10 lines parse correctly and on the 11th it throws the above error. Always on the 11th line and I've tried several different files of varying length and content. I am not closing or disposing the StreamReader before the file is read out entirely. Below is my reading function:
Public Function readNextLine(ByRef buffer As Single()) As Boolean
Dim i As Integer
Dim tempString As String()
tempString = Split(fStreamReader.ReadLine(), cDelim)
ReDim buffer(tempString.Length - 2)
For i = 0 To tempString.Length - 2
If (IsNumeric(tempString(i))) Then
buffer(i) = CSng(tempString(i))
Else
buffer(i) = 0
End If
Next
readNextLine = True
End Function
The above function is called in the following while loop:
Private Sub file_to_dataset(ByVal fileInfo As System.IO.FileInfo)
Dim singleRead As Single() = {0}
fileParser = New clsFileParser(fileInfo, vbTab)
dsLogData.Clear()
While fileParser.peek() <> -1
If (fileParser.readNextLine(singleRead)) Then
If (singleRead.Length = dsLogData.Columns.Count) Then
dsLogData.Rows.Add(singleRead)
End If
End If
End While
End Sub
I've tried changing the buffer size on the streamReader, but it seems to have no effect.
modified on Tuesday, September 8, 2009 4:47 PM
|
|
|
|
|
I found the source of the disposal. Trying to determine the number of columns in the tab separated file by using this statement:
Using newStreamReader As StreamReader = New StreamReader(fStream)
getColumnCount = Split(newStreamReader.ReadLine(), cDelim).Length
End Using
fstream is what I use to open the StreamReader fStreamReader. By invoking the using statement with fStream it appearantly closes the fStream after it's done with it, which causes fStreamReader's baseobject to be closed. This causes the program to throw the ObjectDisposalException.
|
|
|
|
|
Ive had a google about nexted if statements but failing to find what i need, or just am not awake to find it
So here is an example of what i need help with
if textbox1.text = "example" then
if textbox2.text = "another example then
so on.....
END IF
I have done it it java just not sure in VB, in a quick way, when system runs the if statement, if the first if passes then go onto the second if statement.
Could anyone help me out on the correct syntax?
|
|
|
|
|
You seem on the right path, I don't understand the statement..
If x = 1 Then
If y = 2 Then
If z = 3 Then
z = 4
y = 5
x = 6
End If
End If
End If
Assume
x = 1
y = 2
z = 4
Then the first two If statements pass as true but the last If statement, the test on if z = 3 fails , so x,y and z never get changed past 1,2 and 4 respectively.
Did this help?
|
|
|
|
|
Ah right ofc makes sense i was missing out End If and you explain very good. Thanks
|
|
|
|
|
you should also notice how proper indentation improves readability a lot.
Most code editors can do that automatically for you.
|
|
|
|
|
I am currently writing a program that when a user enters a number such as 1267 and clicks a button the number will then be
broken down by its ones place, tens place, and so on. So it would show up as One place is: 7, Tens place is: 6, and so on.
Well I need a little help trying to figure out what code I would write to test or separate each single integer. So far I have only been able to separate the ones place using:
Microsoft.VisualBasic.Right(Textbox1.text,1)
But as u might know, I cant use that for the rest of the values since it only will extract the location you tell it to as well as what ever follows it.
Please help, Thanks
|
|
|
|
|
You could use the Chars property of the String class. This will return the character in the string at any given position.
|
|
|
|
|
would this work if the user were to enter lets say 105,749
then i would need to display,
thousands place is: 105
hundreds place is: 7
and so on
???
thanks for da help
|
|
|
|
|
No it wouldn't, the Chars property on returns 1 character from the string. See Johan Hakkesteegt's response further down to do what you're asking.
|
|
|
|
|
okay so this is the for loop i made but i know its wrong and it doesnt work all the time
I was just trying to see if it would at least display my tens place b4 i move on to work with the other values
For i = 0 To TextBox1.Text.Length - 1
tens = i
Label10.Text = tens
Next i
the textbox would be where the user would enter in the number
tens is a integer variable i created
and the label10.text is where i am displaying the tens value
i know its not right at all but i just wanted to see if i had an idea of what i was supposed to do
|
|
|
|
|
No but you can improve your loop by asking if the current character is a number:
for ind=1 to str.lenght
curchar=mid(str,ind,1)
if isnumeric(curchar) then
...
endif
next
Shay Noy
|
|
|
|
|
you can use the mid function:
mid(yourstring,position,lenght) returns substring.
In your case lenght=1 and position increment each iteration.
Good luck
Shay Noy
|
|
|
|
|
would this be able to work if the
user were to enter lets say 105,789
then i would need to display thousand place: 105
hundreds place is: 7
and so on
??
|
|
|
|
|
or better yet, use .net: Textbox1.Text.SubString(i, 1) where i is the zero based index number of the position you want.
My advice is free, and you may get what you paid for.
|
|
|
|
|
So i could use a For loop, correct?
thanks
|
|
|
|
|
okay so this is the for loop i made but i know its wrong and it doesnt work all the time
I was just trying to see if it would at least display my tens place b4 i move on to work with the other values
For i = 0 To TextBox1.Text.Length - 1
tens = i
Label10.Text = tens
Next i
the textbox would be where the user would enter in the number
tens is a integer variable i created
and the label10.text is where i am displaying the tens value
|
|
|
|
|
i also tried this for loop:
For index As Integer = TextBox1.Text.Length - 1 To 0 Step -1
MessageBox.Show(TextBox1.Text(index))
Next
i am just using the messagebox to get each individual character and show me that it is working.
i am really supposed to be sending it to separate textboxes.
but i dont know or understand how to send the first indexed item to the first textbox to be displayed, and then continue to
send out the other separated characters to the other textboxes.
|
|
|
|