|
I am doing a project for school and I'm trying to pull up an HTML document from a local source. My concern is that when I move the project from my HDD to a CD/ DVD the path will be incorrect and it won't be able to pull up the file. I don't want the computer to be connected to the internet to access the HTML document.
Also, I have images as backgrounds and they are not in my Resource folder according to VB. In the path they are in fact in the Resource folder. Are they going to be integrated?
Thank for any help you may be able to give.
W Lugo
|
|
|
|
|
You'd have to use relative paths for all of your file names in all of your HTML. Don't specify fully qualified paths starting with a drive letter.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hi guys,
I have a datagrid which is dynamically created using server-side code. The columns and rows, and just about any of it are all created depending on the users search criteria.What I want to know is that in the OnItem_DataBound event, a user can do this:
e.item.cells(4).Text = "SomeText"
BUT, when the datagrid is dynamic.. cell number 4 will be different each time. I want to be able to find and target cells by "FindingByText" or something rather than cells(4). Cells(4) is very static.
I hope that made sense. Please ask me any questions to elaborate on my point.
Thank you!
|
|
|
|
|
I don't get how this is supposed to work, or what you're doing with this.
You're trying to fill in Text in a specific column without knowing which column you're filling in? About the only thing you can do to find theproper column is get the names of the column from the DataTable and search through those to get the column number.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thanks for the reply.
I was kinda hoping there is a syntatic way of changing the text of a column on the datagrid when it is displayed. One method is to use the OnItem_DataBound event and use e.item.cells(0).text = "SomeText"
BUT.. the problem is, the column's text that I am wanting to manipulate is not always present when that datagrid is produced. In addition, its position is not known. Therefore if I use e.item.cells(0).Text = "SomeText", it will not work all the time because the column's position changes depending on what columns the user chooses have as part of this datagrid.
One way I was thinking of was to use a "for" loop and say something like this:
Dim i as Int<br />
For Each e.item.cells(i).blabla .. <br />
If the column name is "ColumnName" Then<br />
Select e.item.cells(i).Text<br />
Case x<br />
e.item.cells(i).Text = "Bla"<br />
Case y<br />
e.item.cells(i).Text = "BlaBla"<br />
Case z<br />
e.item.cells(i).Text = "BlaBlaBla"<br />
End Select<br />
End If<br />
Next<br />
Another way of doing this is to change what the database returns. You see, I am supposed to be "Saving" Reports, and those reports are saved in the database as views, and retrieved whenever needed by binding data from the relevant views.
This creates a problem because the view is not always present. I will therefore have to produce code to create the views in such a way that It understands what to do if the column in question is ever selected. Both are doable I think.. but which is easier? or better? hmm...
|
|
|
|
|
What are you doing with this column?? It looks like you're returning a column, but when you go to display it in the datagrid you're replacing what would be shown with some other text entirely, or possibly reformatting the data in that column, correct?
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
lol .. sorry for the confusion.
You are correct. Here are the steps that are involved with the creation of this datagrid:
1 - User Selects the column names from the webpage
2 - User clicks on "Run"
3 - The Application runs a SELECT query involing ONLY the selected Columns.
4 - User Enters a name into a Textbox and clicks on save.
5 - The application runs a "Create View" query to the database. This "Create View" query will have ONLY the columns selected.
6 - You return to the main report page. There is a dropdown list which is populated by data in a table which stores records about 'Saved' Reports(which the user has stored just now)
7 - The user then selects the report name which he just saved from the dropdown.
8 - The name from the dropdown refers to the view which was created.
A - All the views are dynamically created.
B - The same DataGrid is being used to display any of those views.
C - There is ONE column that a User may or may not select.
D - If he selects it, I want the contents of that column to be manipulated; Else forget about it.
Normally for a static set of data being retrieved, I use "e.item.cells().Text = something" for manipulation, but that syntax refers to a column which is in a fixed position and which is always there no matter what. BUT I am looking for some syntax which will target that particular column which may or may not be returned depending on whether the user has selected it.
I am very sorry for the confusion. If this does not make sense to you, don't worry about it any more. It may be too confusing to solve by communicating online.
Thanks a lot for your replies.
|
|
|
|
|
I think I got it now. I think all you have to do is scan the column headers (For I = 0 to MaxColumns) for the name you're looking for, then just save the index of that column for use in your Cells reference.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thanks a lot man. Will try to code it =D
|
|
|
|
|
I have a DVR Card. And i want show video from CCTV camera by DVR Card in form vb.net.
|
|
|
|
|
There is no standard .NET classes that will do this for you. You have to see if your DVR card manufacturer supplies and SDK (Software Development Kit) you can use, or if there is any documentation on what you should be using.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
The SelectCommand property has not been initialized before calling 'Fill'.
shs
|
|
|
|
|
It appears you have not set the sql query or stored procedure in your command before you called your dataadapter.fill method. Do you have another question?
Ben
|
|
|
|
|
You're trying to execute a command without telling your OleDbCommand, or SqlCommand, or AdoDbCommand, object what command to execute. You have to give it the Sql command you want it to execute so it knows what to return to fill your dataset.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Environment: Op Sys 2003 server; Sql Server 2005 with update; Visual Studio; Multiple VB functions and subroutines as stored procedures.This subroutine needs to use a connection string to enable MARS. It does not have the SQL Attributes. They seem to prohibit byref class instantiations being returned.
Dim connectionString As String = _
"server=(local);" & _
"Trusted_Connection=yes;" & _
"database=Frontier_equipment;" & _
"MultipleActiveResultSets=true;"
RecordTypeConnection = New SqlConnection()
RecordTypeConnection.ConnectionString = connectionString
RecordTypeConnection.Open()
Error Numr 5
Error Desc An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
rkj
|
|
|
|
|
Are you sure your sql server name is correct? Are you sure the sql server allows trusted connection. Can you ping the sql server name from where you are trying to run this app? Is there an instance of a sql server you are trying to connect to? You have to put that into your server name. Sometimes you have to set a port number for sql server instances. Anyway, a few thoughts, I hope that helps.
Ben
|
|
|
|
|
I had read that Stored procedures running within the SQL Server could use the local option for server name. Placing the combined servername\sqlservername as the servername worked.!! Thank you.
rkj
|
|
|
|
|
Along with what kubben said, your connection string says that it expects the database server to be on the same machine as the one where your code is running. I hope this is true, otherwise you'll have to change your connection string.
Does your SQL Server instance have Named Pipes enabled?
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
The stored procedures are on the same machine as the server. Replacing server(local) with
servername\server made the whole thing work.
rkj
|
|
|
|
|
If it's a stored procedure, you can try "context connection = true" for the connection string to use the connection that the SP is executing under. But, as you can read here[^], this is not always the best idea.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
I was using that but I needed the MARS capability.
rkj
|
|
|
|
|
Hi All
I want to import excel data into SQL Server2000 through VB6.0, but it gave error. Plz Help.
Regards
smk
|
|
|
|
|
suveenmohan wrote: but it gave error.
And that error would be??
suveenmohan wrote: Plz Help.
Not without knowing what the error message was and what the code looks like that generated it.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
i have a window application in which i am using datagridview. i want to use datagridview as dataentry.
Is there any sample i can use
|
|
|
|
|
Thats pretty much what the DataGridView was designed for. Just about every one of the thousands of DataGridView examples out on the web does this very thing. The examples pretty much show you how to do all kinds of customizations so you can tailor the DGV to do data entry.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|