|
Hi;
This is what is happening in your code snipped.
The error is not happening on the line that the debugger lead you to believe, it is on the next line of code “FieldArray(intField) = strReplace”. What I believe is happening is that in the file FlatFile.txt you have a line that may read as “abc|???” and when the line “FieldArray = Split(strRETP, "|")” executes FieldArray looks like this
FieldArray(0) = “abc”
FieldArray(1) = “???”
so when the program executes the line “FieldArray(intField) = strReplace” it fails with Subscript out of range because intField has a value of 2 but the valid index into FieldArray are 0 and 1. This is what is known as off by one error. Index on an array start at zero not one.
I hope this has been of some help.
-Fernando Soto
|
|
|
|
|
Actually, he's getting the error on the correct line. Split will return an array no matter what. But, if it is executed on an empty string, the array will be returned with no elements in it. This will result in an out of bounds exception if you try to access any element in the array, even if the indexer used is 0, since there are no elements in the array.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You are correct that is a possibility. But once he checks for blank lines he will run into the next problem, off by 1 error.
|
|
|
|
|
This is the documented result of running Split on an empty string. Split will return an array that has no entries in it at all. Enclose your split code in an error handler or check to see if strRETP is empty before running split on it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have never run into this before, maybe you have an answer for me.
I built a script that will send a remote command window to a computer, for the configuration of the Dell Remote Access Card.
Obviously, SERVER, is my variable for the remote computer I want to connect to, and PASSWORD, is my variable for the password I want to set for the account.
The part where I need to use my PASSWORD variable is where I have issues. If I wscript.echo the line back, it is literally putting “ & PASSWORD & “ as my command to be issued. I need my variable PASSWORD in quotes, plus the quote at the end for the command being issued.
------------------------------------------------------------
Set objWMIService = GetObject ("winmgmts:\\" & SERVER & "\root\cimv2:Win32_Process")
errReturn = objWMIService.Create ("cmd /k racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 2 "" & PASSWORD & """, Null, Null, intProcessID)
------------------------------------------------------------
|
|
|
|
|
Your line should read like this: (watch VERY carefully!)
errReturn = objWMIService.Create ("cmd /k racadm config -g cfgUserAdmin -o cfgUserAdminPassword -i 2 """ & PASSWORD & """, Null, Null, intProcessID)
Three quotes on both sides of the PASSSWORD injection. The first two quotes translate to a literal " character in the string. The next quote will terminate the literal string. Then, of course, your PASSWORD string gets appended. The the first quote starts a new string literal, the first character of which is a ", represented by the two quotes characters immediately following each other.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dim com As New OleDbCommand(ComStr + tabname, con1)
Dim OleDap As New OleDbDataAdapter()
OleDap.SelectCommand = com
Dim ds1 As New DataSet()
dim DT as datatble
DT = con1.GetOleDbSchemaTable(OleDbSchemaGuid.Primary_Keys, New Object() {Nothing, Nothing, tabname, "table"})
Label1.Text = DT.Rows(0).Item(0).ToString
con1.Close()
There is an error in this code.
Error: "Invalid Parameters"
Please help.
Thanks in advnce.
|
|
|
|
|
|
Here is the code
dim con1 as new oledbconnection(..connection string..)
Dim DT As DataTable
con1.open
DT = con1.GetOleDbSchemaTable(OleDbSchemaGuid.Primary_Keys, New Object() {Nothing, Nothing, tabname, "table"})
Label1.Text = DT.Rows(0).Item(0).ToString
datagrid1.datasource = DT
con1.Close()
It gives runtime error "Invalid Parameters"
Please help.
|
|
|
|
|
|
Sir, can you please let me know the code to do the needful.
I will be highly obliged.
Thanks.
|
|
|
|
|
I have upgraded a big program from VB6 to VB.NET. The program draws
and writes on some picturebox.
1) I have not well understood how to upgrade the AutoRedraw feature.
Documentation speaks sometimes about the OnPaint method of the form,
to be overridden with some refreshing instructions, sometimes about
the Paint event. For the time being I am obliged to utilise a
CommandButton triggering a refreshing routine in order to restore the
graphics when, for some unknwown reason, it disappears leaving a blank
page.
2) The ToolTip textbox has a strange behaviour on my picturebox: first
time it is displayed and then moved, the underlying graphics is not
restored. Subsequent appearance of the textbox runs correctly
Any help available?
Thank you
Leonardo Presciuttini
|
|
|
|
|
how do i send SMS from landline to cell phone in VB6
|
|
|
|
|
Google for "VB6 SMS"[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Does anyone know anything about AppConfig files and how to integrate them into a SQL application because it is the only way i can think of to install my app on other computers and somewhat painlessly setup the connection string for the app. I know nothing about XML. HELP ME
|
|
|
|
|
Right click on your project, select "Add -> New Item" and select "Application Configuration File". Make sure it is called "App.Config".
On your application drag from the toolbar to your form a "SqlConnection" object. View properties of SqlConnection object and select "Dynamic Properties" then Check the default "Connection String".
Next, create a connection string and save all.
By now you should see in "App.Config" a key value pair that is added for your SqlConnection object and its connection string.
To read from your code:
using System.Configuration
myConnectionString = ConfigurationSettings.AppSettings("your key name")
|
|
|
|
|
I you want to do this in code (versus the IDE) let me know, or, if you need XML that you can read AND write from code (like by screens from user input) let me know.
I have some real-work examples.
If the IDE workds for you - great.
Good luck - Len
Thanks,
-Len Miller
"If I had eight hours to chop down a tree, I'd spend six sharpening my axe."
-Abraham Lincoln
|
|
|
|
|
This is how u have to place ur connectionstring in your app.config file.
<configuration>
<appSettings>
<add key="DBConnString" value="Data Source=ervername;Initial Catalog=Databasename;User ID=userid;Password=password;"/>
</appSettings>
</configuration>
For accessing this value from DB you can use this line of code in vb.net (in case of C# hope u can manage it, or ask me)
Public Shared CONNECTSTRING As String = System.Configuration.ConfigurationSettings.AppSettings("DBConnString")
Hope its fine and ur prob is solved.
Het Waghela
Be Humble in Victory and Strong in Defeat.
Het Waghela, Blog|Het Waghela DotNet Questions Link|
|
|
|
|
|
i m trying to stream media files on VB.NET interface using Windows Media Player component.. but its not being played..
well, i hav tried embedding the windows media player component on the WebApplication.....it is appearing on the client side but it is not able to play any files...... and we are not able to even select any controls provided in the player...
we are using Windows 2000 Advanced Server as OS.
actually we dont ve much idea about how streaming takes place on the internet and do we need to add any other codec or component to achieve Media Streaming ???
waiting for replies.
thanks..
|
|
|
|
|
I wrote a vbscript that closes Internet explorer windows. The main reason i'm doing it this way it to get the LocationURL property of the objIE object before I call Quit on it.
The problem is that not all windows close this way.
Any suggestions?
<br />
Set objShell = CreateObject("Shell.Application")<br />
Set objShellWindows = objShell.Windows<br />
dim i, nCount<br />
nCount = objShellWindows.Count<br />
nCount = nCount - 1<br />
<br />
for i = 0 to nCount<br />
dim objIE<br />
<br />
set objIE = objShellWindows.Item(i)<br />
if (not objIE is nothing) then<br />
objIE.Quit<br />
end if<br />
next<br />
|
|
|
|
|
What do you mean by "not all windows close this way"? Are you talking about close JUST the IE windows or all applications? Also, before you close the IE window, you might want to try checking the .Busy property and wait until the borwser window is finished. I'm not syaing that this will solve the problem, but it might...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I was wondering if there is a way in VS.net to setup site templates similar to how you accomplish this in Dreamweaver, for example, so that you could make changes to one page that would propegate to the other pages of the site as well...
Anyone know how to do this???
I actually tried setting templates up in Dreamweaver and then doing my dynamic code in VS.net, but when I made changes in VS.net and tried to go back to Dreamweaver and make changes to the template, i get errors....
Thanks
cavall
"Nothing is at last sacred, but the integrity of your own mind."
"What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson
|
|
|
|
|
Your question belongs in the ASP.NET Forum. It is possible to do this in ASP.NET 2003, but it gets much easier to do in 2005.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello, I write my vb.net class and I want that when another developer will be use my class the VS 2003 show a small help that say the meaning of the methods, something like the functions that VS incorporate. For example, when I write me.text VS show us a small tips that say the meaning of text in this object. Then my question is Can I do something like that?
Thanks, and excuseme but my english is very very very bad.
|
|
|
|
|
Basically you want the feature that is already available in csharp.net. Unfortunately that feature is not available in VB.net; however, I verified that this feature works with VS2005 Beta.
Anyway, to show tooltips of your methods for next VS2005 version, just add the following xml text before you declare any method:
your class description
I suggest you look for information about VBCommenter which automatically adds the tags you need and then learn to use NDoc to automatically create help files like the ones from Visual Studio.
|
|
|
|