|
How about something a little more usefull[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Lets say you wanna write data into binary file. Make sure you already convert the data into byte array (in this examples: StreamByte()). And if you;re using vb 2005, use this a line code to write to file.
My.Computer.FileSystem.WriteAllBytes("C:\MyData.dat", StreamByte, True)
Set the last argument to False if you want to append the file. It means, you can add more bytes chain into the same file.
And if you wanna read your data, use this one
Dim StreamByte As Byte() = My.Computer.FileSystem.ReadAllBytes("C:\MyData.dat")
hope this helpful.
|
|
|
|
|
How do I fix this error.
Pls I have the following code as a method in a class.
Public Function adminlevel() As Dataset<br />
Dim adminsql As String = "Select * from userlevel"<br />
Dim admindata As New SqlClient.SqlDataAdapter(adminsql, con)<br />
Dim adminset As New DataSet<br />
con.Open()<br />
If con.State = ConnectionState.Open Then<br />
admindata.Fill(adminset, "userlevel")<br />
<br />
admlevel = adminset.Tables("userlevel")<br />
<br />
con.Close()<br />
'Catch ex As Exception<br />
' MsgBox(ex.Message)<br />
'End Try<br />
Else<br />
MsgBox("No Connection")<br />
End If<br />
Return admintable<br />
End Function<br />
<br />
<br />
//at form end I have following code to bind combo box cboUser to a databse field.Stepping thru the code line cbouser.displaymember="levelname" returned the error after the code.<br />
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Try<br />
Dim myuserlevel As New Underwriter.Underwriter<br />
Dim load As New DataTable<br />
load = myuserlevel.adminlevel()<br />
cboUser.DataSource = load<br />
cboUser.DisplayMember() = "levelName"<br />
cboUser.ValueMember() = "levelname"<br />
Catch ex As Exception<br />
MsgBox(ex.Message)<br />
End Try<br />
<br />
End Sub<br />
<br />
the error returned is below:<br />
Could not bind to the new display member <br />
Parameter: newDisplayMember
Fikunmi Feyijin
Hicad Systems
Nigeria
|
|
|
|
|
You might want to step through your Form1_Load code and watch the load variable to see what it contains after the load = myuserlevel.adminlevel() line. Make sure it contains a DataTable with the correct column names. Somehow, I doubt it, especially after looking at the code of your adminLevel method. What is admintable and where was it defined? I notices that you're assigning adminLevel a supposedly filled DataTable, but then you go and return a different variable, namely admintable , to the caller. Which is it?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi dave,
Thanks, the way I referenced the column names was wrong. The System is case sensitive. All I did was to ensure the correct casing of the column names in the database
So my system now works.
Fikunmi Feyijin
Hicad Systems
Nigeria
|
|
|
|
|
Hi All,
I want to convert an excel report in English Language to chineese language.
Plz Help ....!!! its urgent.....
|
|
|
|
|
What does this have to do with VB.NET???
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
While am running my vb.net,Sql server based Application through network
find the following issue,
"Request for the permission of type
System.Security.Permissions.EnviornmentPermission, mscorlip,
Version= 1.0.5000.0, Culture=netural,
Public Key token=b77a5c561934e089 failed."
How to handle this issue ?
Have any tool is avilable for correct this issue?
Advance Thanks
Anandan k
Steadfast Technology Services Private Ltd
|
|
|
|
|
Is your .EXE being launched from a network share or network mapped drive latter? If so, this is probably the source of your problem. Code running from any remote source, by default, is not trusted. You can learn about Code Access Security here[^]. It's a pretty large topic, and affects everything you do while using the .NET Framework so it's a good idea to understand, at the very least, the basics of how, and why, code security works.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I am student of final year engineering student. I selected “SMS Website” as my project topic. In this I have to send Bulk SMS through website and provide other kind of services related to SMS.
Please tell me which steps I should follow to make this kind of software.
Please send me some material or any kind of source code related to it.
I need your help.
Thank you!!!
Contact Me: ashish.0619@gmail.com
|
|
|
|
|
Why don't you start by reading up on how to send SMS messages first[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi All,
Anybody knows how to drag drop multiple rows from one datagridview
to another.I know how to drag drop single row.If any body have idea please
guide me how to do this.
Thanks,
venkat
|
|
|
|
|
I take it you're sending a DataRow object when you call SetData? Off the top of my head, you can probably create your own implementation of the IDataObject interface and encapsulate 1-n DataRow objects in it (implement your own collection of them), then just send that object instead of the one DataRow.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hello everybody...
can any one plz tell me how to resize our windows application form according to monitor size????
The exact requirement is ....I have Developed an vb.net windows application..
I have done this in a lcd moniter..bcz of this the controls are in size which fits to lcd moniter.
now my problem is when my application is used in ordinary moniters some controls r out of the screen..
I have tried setting windows form size to normal..its not woking ..
PLS GIVE ME ALTERNATIVE WAY OTHER THAN RESIZING THE CONTROLS IN MY FORM....
Thanx
BINO VARGHESE
|
|
|
|
|
There's a Screen class (from memory ) which has a PrimaryScreen property that you can get the screen size. Or, you can just set it to maximise.
BINO VARGHESE wrote: bcz of this the controls are in size which fits to lcd moniter.
There is no such thing as LCD monitor size. An LCD typically goes lower than a CRT of the same size, but still supports all standard sizes.
BINO VARGHESE wrote: PLS GIVE ME ALTERNATIVE WAY OTHER THAN RESIZING THE CONTROLS IN MY FORM....
You should never resize controls, you should set the anchor or dock properties so they position themselves.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
|
Are you asking about the theme of the window or the controls in the window?
|
|
|
|
|
It's just two list boxes, I don't think it has a name. It's common in web sites, is that where you want to set it up ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi!
I'm stuck on a inheritance/typecast problem and would like some help.
I have two modules named Main.vb and Test.vb with the following contents:
'---------------- Test.vb ------------------------------------------------------
Imports SHDocVw
Module Test
Public Class clsTest
Public HWND As Long
'
' Omitted additional members goes here.
'
End Class
Public Sub doSomething(ByRef c() As clsTest)
Dim i As Integer
Dim ieCollection() As InternetExplorer = Nothing
'
' Omitted code that populates ieCollection goes here.
'
i = 0
For Each ie As InternetExplorer In ieCollection
' [Insert #1]
c(i).HWND = ie.HWND
i += 1
Next
End Sub
End Module
'---------------- End of Test.vb -----------------------------------------------
'---------------- Main.vb ------------------------------------------------------
Module Main
Private Class clsTestExtended
Inherits Test.clsTest
Public strParam1 As String
Public strParam2 As String
End Class
Public Sub main()
Dim ce() As clsTestExtended = Nothing ' [Change #1]
' [Insert #2]
Test.doSomething(ce)
For Each c As clsTestExtended In ce
c.strParam1 = ""
c.strParam2 = ""
Next
End Sub
End Module
'---------------- End of Main.vb -----------------------------------------------
This is my problem:
If I insert the following piece of code at the [Insert #1] marker in Test.vb:
If c Is Nothing Then
ReDim c(0)
Else
ReDim Preserve c(i)
End If
c(i) = New clsTest
then, on return from Test.doSomething, I get a runtime error:
Unable to cast object of type 'clsTest[]' to type 'clsTestExtended[]'
If instead of the above modification, I change the line marked [Change #1] in Main.vb to
Dim ce(1) As clsTestExtended
and insert this piece of code at the [Insert #2] marker in Main.vb :
ce(0) = New clsTestExtended
ce(1) = New clsTestExtended
then I get no runtime error (assuming the 'For Each' loop in Test.doSomething doesn't loop more than twice). The problem is that the main() sub can't/shouldn't know before the call to Test.doSomething how big the ce array will be on return from Test.doSomething and so dimensioning ce before the call to Test.doSomething is not safe.
What I really want to use is the first modification but without the typecast problem or another solution to the problem that achieves the same thing (which is: the main() sub works with the inherited 'ce' classes while the doSomething sub can dynamically change the 'c' classes and have the changes made available to the main() sub in the 'ce' classes).
Any ideas?
Best Regards,
Anders
-- modified at 16:00 Friday 1st December, 2006
|
|
|
|
|
Why are you using an array instead of dynamic container ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Christian,
Thanks for the quick reply!
Ummm, 'dynamic container' I think I need some hints here. Never heard of that before. Still trying to absorb all the new NET stuff.
Best Regards,
Anders
|
|
|
|
|
Your first step should be to remove references to the VisualBasic namespace. I suspect this is where Redim and so on are coming from. VB.NET contains a lot of bad stuff from VB6, only because MS was forced into it by people complaining. They are all in that namespace. Delete that, or you'll end up coding VB6 in .NET and not get the full benefit of moving.
If it's VS2005, you can create a List<baseType>, which is a generic container, to which you can add and remove objects at will. You therefore don't need to redim anything. If you ever need an array, those containers offer methods that return them.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Did some reading about Lists and generics and they look really useful. I'm not sure though how Lists and generics can solve my main problem (which is having the 'doSomething' sub work with the list as if it is a list of 'clsTest' objects while the 'main' sub can work with the same list as if it is a list of 'clsTestExtended' objects) but maybe that will become obvious if I do some more reading on the subject.
Best Regards,
Anders
|
|
|
|
|
I need to know how to make the DateTimePicker control in VB 2005 to basically real-time update itself. I want the DateTimePicker to keep track of the time. Guidence?
|
|
|
|
|
Well, the control really wasn't meant to be used the way you want to, but it's probably possible if you drop a Timer control on your form, set it for 1000 millisecond interval, then handle the Timer's Tick event. In the event handler code, just set the DateTimePicker's Value property with the current DateTime.Now().
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|