|
A lot of the VB.Net articles use code that is not compatible with VB2003 (such as generic collections and the like) but it is not usually too much trouble to convert it back to 2003 (and even - shock, horror) VB2002.
|
|
|
|
|
Freddie Code wrote: Can I assume that articles and code for VB.NET 2003 will work in VB.NET 2005?
In most cases, yes. ASP.NET is potentially more problematic though.
Best thing to do is work with the 2003 articles and then search MSDN for what's changed between 2003 and 2005.
Kevin
|
|
|
|
|
Hello codeprojectusers, I am writing a very simple web server for no real reason and if does kind of work, but when I get a request from a client I get an error from visual basic 2005 .net. It says that access to the folder requested was denied.
this is the code i am having a problem with
Dim fs As FileStream = New FileStream(filename, FileMode.OpenOrCreate)
I have no idea how to fix this without using that request permission method which I cannot get to work, soooooo I would appreciate any help, Thanks
Aaron
|
|
|
|
|
Use application folder of system with system.environment.application. It will never give up access denied.
Thanks & Regards
Kumar Prabhakar
abc
|
|
|
|
|
Thanks I will try that.
Aaron
|
|
|
|
|
i finish my project in vb.net 2003 and sql server 2000 now i need to make setup package and i don't know how to install data base on target machine
i need to install database and msde on client computer
how?
ma_refay
|
|
|
|
|
I have a project I wrote that uses MSDE for a database and installs it with the program. If your interested email me and i will send you the program. It's pretty big though because of the MSDE so we will have to send it through messenger or some thing along those lines.
Pablo
|
|
|
|
|
Check out this link
http://msdn2.microsoft.com/en-us/library/49b92ztk.aspx
Navi
|
|
|
|
|
I am working with VB.Net 2003; I see a lot of programs being designed a lot like Outlook. With the left pane with options and the right pane showing like the data grid or something. Then you can click on something like add new record in the left pane then an input box will come up so you can enter the data for a new record and save it.
Is there a template that allows you to do this? If so, can someone tell me where to go to get it?
Thanks!
|
|
|
|
|
Hi all
This is my first post so please be gentle!!
Ok im not new entirely to VB.net but I am totally new to threading/async calls/cross thread interaction.
The sample code below is an async operation to catch received socket traffic.
The async method works just fine in capturing what i need, now i need to raise an event from my class to the form it was instantiated on, but doing so in a thread safe manner. To do this I have been using a sync object of type "System.ComponentModel.ISynchronizeInvoke". I pass my main form to this object as the synchronising object. as below (this is the new method of my class)
<br />
Public Sub New(ByVal BufferSize As Int32, ByVal SyncObject As System.ComponentModel.ISynchronizeInvoke)<br />
_SyncObject = SyncObject<br />
_Connected = False<br />
_BufferSize = BufferSize<br />
End Sub<br />
Now this sync object i use handles all my thread safe calls without any issue except for my receive method as follows:
Private Sub BeginReceive(ByVal ar As IAsyncResult)<br />
Try<br />
Dim _Bytes As Byte() = CType(ar.AsyncState, Byte())<br />
Dim _numBytes As Int32 = _Socket.EndReceive(ar)<br />
<br />
If _numBytes = 0 Then<br />
Dim c As New dlgNoParams(AddressOf Disconnect)<br />
_SyncObject.Invoke(c, Nothing)<br />
Else<br />
Dim _Data As String = _Ascii.GetString(_Bytes)<br />
Dim args(0) As Object<br />
args(0) = _Data<br />
Dim d As New dlgReceiveData(AddressOf ReceiveData)<br />
_SyncObject.Invoke(d, args)<br />
Dim e As New dlgNoParams(AddressOf StartReceive)<br />
_SyncObject.Invoke(e, Nothing)<br />
End If<br />
Catch ex As Exception<br />
<br />
Dim myType As Type = ex.GetType<br />
Console.WriteLine(myType.ToString)<br />
If Not myType.FullName = "System.Net.Sockets.SocketException" Then<br />
Dim f As New dlgErrorEvent(AddressOf ErrorEvent)<br />
Dim args(0) As Object<br />
args(0) = ex<br />
_SyncObject.Invoke(f, args)<br />
Else<br />
'_QueueThread.Abort()<br />
_Socket = Nothing<br />
End If<br />
End Try<br />
End Sub
I have several other methods that are executed on the forms main thread using the same methods as obove but just references different delegates, but the basics behind them all are very similar.
Every time i receive data through the socket i get a "NullReferenceException was Unhandled" with a message of{"Object reference not set to an instance of an object."}
Can anyone point me in the right direction please? or offer me an alternative to a thread safe method of raising an event within my class that runs from this async thread please?
Many thanks in advance and thanks for looking
Highlander
It seems this only errors out when passing the args object as a 1-dimensional array which holds a string. If i pass the word 'Nothing' instead of the args object i dont get the error. But i need to pass args as the method processes the data and raises the appropriate event. Any ideas? I have Bold/Underlined the offending line where i get the error. Thanks again
-- modified at 10:58 Monday 28th August, 2006
|
|
|
|
|
Hi i have a problem on how to create a .csv file using vb.net in windows appliaction. i am required to read information from a dataset and then retreive some certain information to create this .csv file. Problem is i do not know how to create the file and i need to save it to a location without prompting the user to select where to save. need help urgently and informations pls let mi knows thanks a millon.
KaKaShi HaTaKe
|
|
|
|
|
Hi There
Bascially a csv file is a plain text file holding records line by line, each field on the line seperated by a comma (,)
You need to open/create a file using the system.io objects
use a datareader of sorts to access your dataset tables row by row
create a string of each row like so:
field1,field2,field3,field4....etc
then write that line to the file, each line = 1 row
then capture the next row and recreate your string with fields seperated by , (commas) and so forth. I could easily write the code here but I think you would learn more if you attempt it. Its easier than it sounds
|
|
|
|
|
Dear All
i m new to vb.net .in my first application i move the datareader feild to one
text control but on screen it text box control display last 3 charecters and rest of value is there but cursor postion comes at the end of control,how to set this property.
Regards
Syed Nabeel Rashid
|
|
|
|
|
Check out this link
http://www.vbcity.com/forums/topic.asp?tid=20175
Navi
|
|
|
|
|
hi,
Is there a way to increase the number of the maxDropDownItems in the comboBox column of a DataGridView or a way to customize it , so it can allow more than 100 items, and how can I add vertical ScrollBar for the combobox , in Vb.Net
Regards,
MK
|
|
|
|
|
Hi All.
I am using ADO, Visual Basic 6.0 to connect to the dbf file to query corresponding table. After finish the query, I've closed the record set and the connection but I still could not rename that file (renaming is used for another purpose). Windows says that the file is in use by other person or application. I can only rename the file when the application using the connection above close (shutdown). Please tell me know to release completely to that file even though the application is still running.
Thanks so much.
Arien.
|
|
|
|
|
Make sure that every object that uses the connection is closed. You may have to set each db object to nothing also. Go through your code line by line and ensure every mention of the database connection has been closed properly. There must be an object still connected somewhere, especially if you close the app you are able to rename it. Also you may have to give the objects a little amount of time to complete its closing events before you can access the file to rename it. Hope this helps!
Highlander
|
|
|
|
|
Thanks so much Highlander.
Hieu Nguyen
|
|
|
|
|
Problem solve to delete multiple record at once:
Set rr = DB.OpenRecordset("SELECT * from DO where [NO] = " & dono.Text)
Do
rr.Delete
rr.MoveNext
Loop Until (rr.EOF)
rr.Close
Set rr = Nothing
-- modified at 22:56 Tuesday 29th August, 2006
|
|
|
|
|
Why not try writing a delete query?
|
|
|
|
|
Write an SQL query like this:
DELETE * FROM DO WHERE [NO]= [your_value_here]
...connect to your database and use the execute command to run this query.
|
|
|
|
|
Why are you settings a connection string for the connection, then using a different connection string?
Is the no field text or numeric? In the delete query you are using a string value, but in the select query you are using a numeric value.
After the delete query, don't delete anything from the recordset. As you are not opening the recordset in this code, it may contain anything from any previous code, and you may be deleting something completely different.
---
b { font-weight: normal; }
|
|
|
|
|
It's more a question about "wat" you should delete...
I've commented out the lines that you should remove:
Set cn = New adodb.Connection
' cn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source= db1.mdb"
cn.Open constr ' constr is a connection string
sqlsql = "delete * from [DO] where no = " & "'" & dono.Text & "'"
cn.Execute sqlsql
' Do
' rr.Delete
' rr.MoveNext
'
' Loop Until (rs.EOF)
' rr.Close
' Set rr = Nothing
sql = "select * from DO where [NO]= " & dono.Text
doadodc.RecordSource = sql
doadodc.Refresh
MsgBox ("Record Deleted")
As you haven't answered the question about the data type of the "no" field, I don't know if you should keep the apostrophes in the query or not.
---
b { font-weight: normal; }
|
|
|
|
|
campbells wrote: is comment the this line it will have error so i remain put it in.
' cn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source= db1.mdb"
Ok, so then the constr variable that is supposed to contain the connection string doesn't? Don't use it then.
campbells wrote: and i cant remove this because it will not delete anything from my program...but i think i found the error here... when i use this code it will totally delete my whole table record... i think because i set
rr = DB.OpenRecordset("DO"), but is it possible to set rr = DB.OpenRecordset("delete * from [DO] where NO = " & dono.Text)?? i mean put sql in it.. it not really working actually.
I think that you should read up a bit on what SQL queries do and how the Recordset object works. If you want to delete the records using SQL, you don't use a recordset at all. If you want to delete the records using a recordset, you only use a select query to specify what the recordset contains.
---
b { font-weight: normal; }
|
|
|
|
|
campbells wrote: how do i put the SQL in the recordest? cause when i put rr = DB.OpenRecordset("DO"), it mean the whole table in DO.
What you are using is the command type TableDirect, meaning that you open the entire table. If you use an SQL query instead, you will be using the command type Text, meaning that the query is used to select the records for the result.
campbells wrote: ACtually my SQL to select specific record only
delete * from [DO] where NO = " & dono.Text
No, that is not a query to select records, that is a query to delete records.
---
b { font-weight: normal; }
|
|
|
|