|
roopali gupta wrote: if u can give me ur email id i can send u d table..
Surprisingly, he has a life and is not offering to accept your piecemeal work, to do for free.
Perhaps if you don't understand how to write basic SQL, you should buy a book on it ?
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.
|
|
|
|
|
please check your email
Best Of Regards,
SOFTDEV
Sad like books with torn pages, sad like unfinished stories ...
|
|
|
|
|
Hi guys
I have a simple bit of code which opens up Internet Explorer, navigates to a web page, selects a value from a drop down menu (options are either "Yes" or
"No") and submits the form.
The code works fine if it is selecting "Yes" however if I change it to "No"
it dosn't work. Here is my code:
*************************************************
strURL =
"http://corporate1.internal.standardlife.com/phoneline/Phnline.nsf/frmStaffUpdate"
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate strURL
objIE.Visible = False
While objIE.ReadyState <> 4
wscript.sleep 300
Wend
objIE.Document.all("kwdshowphoto").Value = "Yes"
Call objIE.Document.Forms(0).Submit
objIE.Quit
***************************************************
Here is part of the source code of the internal website, which relates to
the drop down:
<table border="0" width="100%" cellspacing="0" cellpadding="0"><a
width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td class="sectionHead" width="350"><a width="1%"><img
width="359" height="1" src="/icons/ecblank.gif" border="0" alt=""><br>
My location data / PhoneLine photo</td><td class="sectionHead" ><a
width="100%"><img width="1" height="1" src="/icons/ecblank.gif" border="0"
alt=""><br>
<div align="right"><a href="javascript:PhonelineHelp();" class="globalNav"
title="launch phoneline help">Help</a> </div></td></tr>
<tr valign="top"><td width="350"><a width="1%"><img width="359" height="1"
src="/icons/ecblank.gif" border="0" alt=""><br>
</td><td ><a width="100%"><img width="1" height="1" src="/icons/ecblank.gif"
border="0" alt=""><br>
<br></td></tr>
<tr valign="top"><td class="labelText" width="350"><a width="1%"><img
width="359" height="1" src="/icons/ecblank.gif" border="0" alt=""><br>
Show my photo on Phoneline :</td><td class="dataText" ><a width="100%"><img
width="1" height="1" src="/icons/ecblank.gif" border="0" alt=""><br>
<font size="2">
<input name="%%Surrogate_kwdShowPhoto" type="hidden" value="1">
<select name="kwdShowPhoto">
<option>Yes
<option selected>No</select>
</font> </td></tr>
<tr valign="top"><td width="1%"><img width="359" height="1"
src="/icons/ecblank.gif" border="0" alt=""><br>
</td><td width="100%"><img width="1" height="1" src="/icons/ecblank.gif"
border="0" alt=""><br>
<br></td></tr>
Thanks in advance
Jamie
|
|
|
|
|
dodg3r7 wrote: While objIE.ReadyState <> 4
wscript.sleep 300
Wend
This won't solve your issue, but you'd do better to handle the event of the state changing and respond to it, than doing this.
dodg3r7 wrote: The code works fine if it is selecting "Yes" however if I change it to "No"
it dosn't work.
Does the value get changed to 'no' ? What does 'it doesn't work' mean ? What goes wrong ?
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.
|
|
|
|
|
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
??
|
|
|
|