|
Hi there,
I'm really looking for something like the CBitmapSlider (http://www.codeproject.com/staticctrl/CBitmapSlider.asp), which is perfect, but in VB. I'm only a poor student so can't afford to buy anything and am too new to vb.net to try coding my own controls (tho some good tutorials may also be a help..)
Cheers in advance
|
|
|
|
|
Hi,
Is it possible to enumerate an Enum. For example...I want to add all the possible values of an Enum into a combo box so that the values can be selected.
Enum MyEnum
Val1
Val2
Val3
End Enum
...
Nursey
Then something like
for each lValue in MyEnum
combobox.items.add(lValue.ToString())
next
Thanks
|
|
|
|
|
Public Enum flag
red = 1
white = 2
blue = 3
End Enum
For Each flagcolor In [Enum].GetNames(GetType(flag))
MsgBox(flagcolor)
Next
|
|
|
|
|
Many thanks for such a complete and details response my friend.
You inspired me to this..
MyCombo.Items.AddRange([Enum].GetNames(GetType(MyEnum)))
Combo populated with all enum values in one line of code.
Thank you for your help.
Nursey
|
|
|
|
|
Ok, its true I have only one tip, not the usual 1001 tips for VB 8-)
I have been heavily developing my Theme control system and need flicker free drawing on the surface of a panel. The solution was so sweet I just thought I would share it for two reasons. 1) See how simple things are to do in .NET, 2) I can't see a forum for sharing little nuggets...oh 3) was going to be you can see what a God I have become at this stuff in only 2 weeks (BOW MORTALS!) hahaha
' Create a panel whose Graphics object is double buffered to eliminate flicker when drawing
Public Class BufferedPanel
Inherits Panel
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.DoubleBuffer Or ControlStyles.UserPaint, True)
End Sub
End Class
Jeez, that was a big build up for such a poxy one line of code, but there you go. If you want flicker free drawing, just inherit a control and stick a SetStyle on it. In the Paint event of the BufferedPanel you draw anything you want to and its flicker free.
Thanks for reading!
Nursey
|
|
|
|
|
Hello everyone!
I'm trying to debug a vb.net project and it is not working like I expected.
In the vb6 I would open the project set my break points and run it.
When ever the line that has the break point was called from asp page running locally
it would stop. It does not work the same in vb.net
Can some one tell me what am I doing wrong or a where I can find a good article about debugging
Class library project.
Thanks in advance
Iluha
|
|
|
|
|
I think I'm going mad. I created a db, made a form for the primary data entry functions, then tried to create a new recordset in a module associated with the form. The form is for entering a timestamp when a valid user checks in, and part of the challenge is to verify that the user has entered a valid name and password (from a separate table) before allowing the update to the primary table. After days of trying to make it work I finally got an intelligible error message informing me that the Database and Recordset types are not recognized. The code is essentially straight out of the online reference manual, to wit:
Dim db As Database
Set db = CurrentDb()
Dim rst As Recordset
Set rst = db.OpenRecordset....
Searching through Help for this problem leads me to the statement that the Data Access Objects are not installed; Add them to your Visual Basic Project References. This isn't a VB Project, just a simple Access 2000 application. There are no project references to set, and it's inconceivable that a database product would not install the type definitions required to work with databases! I've reinstalled Access 2000 three times so far, and applied SP3 to the installation. I haven't a clue what to try next. Any suggestions?
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
If I recall correctly, you should still have a menu option for References under Tools in the VB editor that appears when you are editing your module. Go in there and make sure the reference to ActiveX Data Objects and DAO have not gotten unchecked somehow.
Datagrid Girl
|
|
|
|
|
Good call - they have been unchecked. Along with a few hundred others, and not a one of them has any descriptive information. Multiple versions of ActiveX, and DAO... What a farce. Thanks for the clue - I got the Database and Recordset objects initialized. Now I need to figure out what it's telling me with a popup that says "Too Few Arguments - 4 Expected" without in any way identifying where the error occurred. Another day of single-stepping is ahead, I suppose.... Thanks!
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
PLEASE HELP
I have a requirement to send messages over TCPIP. The format of this message is 2 bytes for a binary length of the entire message, 6 spaces and then the message. The length of these messages can be as least 66 bytes and up to 5500 bytes.
I had this working in VB6, but now need to re-write it in .net. The code I used in VB6 is as follows:
Public Function buildIPheader(lgth As Long) As String
'set the length of the TCP/IP header
'add 8 bytes for the IP header
lgth = lgth + 8
'IP Header = 8 bytest, first two bytes are length of record, last 6 bytes are unused.
'compute the length into binary format
Dim comp1, comp2
comp1 = lgth \ 256
comp2 = lgth Mod 256
'2 bytes binary for the length and 6 bytes spaces for future use
buildIPheader = StrConv(ChrB(comp1), vbUnicode) & _
StrConv(ChrB(comp2), vbUnicode) & _
" "
End Function
As you know the chrB and vbUnicode are no longer supported under .net. I have tried the encodeing getbytes method but that creates an array which I can't use.
Does anyone know how to do this using VB.NET??
|
|
|
|
|
Why do people ALWAYS FORGET that unicode takes TWO BYTES for ONE CHARACTER?? If you would change the encoding from ASCII to Unicode in the example below, you would only get one char and six spaces... And if you write new programs in .NET i suggest you use UTF-8 encoding (1 OR 2 bytes / char)
Use ASCII encoding if you want only 8 bytes:
Public Function buildIPheader(ByVal Length As Integer) As String
Length += 8
Dim comp1, comp2 As Byte
comp1 = Length \ 256
comp2 = Length Mod 256
Return System.Text.Encoding.ASCII.GetString(New Byte() {comp1, comp2}) & " "
End Function
However, in .NET you should (better) work with byte arrays and then the code looks like this :
Public Function buildIPheader(ByVal Length As Integer) As Byte()
Length += 8
Dim header(7) As Byte
header(0) = Length \ 256
header(1) = Length Mod 256
System.Text.Encoding.ASCII.GetBytes(" ", 0, 6, header, 2)
Return header
End Function
And as the other six bytes are unused, I wouldn't even set them, or set them to zero
greetz
*Niels Penneman*
Software/Dev Site Personal Site
|
|
|
|
|
Hi
I would like to get the source of HTML doucmnets for the net (like from cnn site) in to string .
Can any one help and tell me how to do that in VB6
Thnaks
MXG
|
|
|
|
|
Use Microsoft Inet control? or try HTTP request with WinSock, but I guess that is harder to do...
greetz
*Niels Penneman*
Software/Dev Site Personal Site
|
|
|
|
|
wininet.dll
InternetOpen
InternetOpenUrl
InternetReadFile
I have a small sample i wrote years ago. let me know if you want a copy.
|
|
|
|
|
I want to access my MDI forms menus from a child form.
like I want to enable all the menus in my MDI form(which is a startup form) after the user
logs in successfully.
How can I access my Mdi forms menus/controls from a child form
Thanks
tasnim.
|
|
|
|
|
If this is VB.NET, use the Form.MdiParent property. If this is VB5 or 6: call the form by its name
greetz
*Niels Penneman*
Software/Dev Site Personal Site
|
|
|
|
|
dear all,
how to draw the waveform of a wave or mp3 file using visual basic....i want to draw the waveform for a playing wav file and also for a static wav file.
Any links tht can help me to do this?
Regards
rIsHaBh
|
|
|
|
|
|
Hi.
I got a problem getting a program i wrote in VB.net to work with excel 2000.
It works well with excel 2002.
The error occures within this code:
ExcelApp = New Excel.Application()
ExcelBook = ExcelApp.Workbooks.Open(ExcelFile, False, True)
ExcelSheet = ExcelApp.ActiveSheet
This is the error i get:
"Object reference not set to an instance of an object.
interop.excel
at Excel.Workbooks.open(String Filename, object Updatelinks .......all the optional attributes.......) "
Odd Magne Vea
|
|
|
|
|
Have you tried to re-import the libraries you are using? Because interop DLLs probably need to be regenerated to work with another file version...
greetz
*Niels Penneman*
Software/Dev Site Personal Site
|
|
|
|
|
Hi, My name is Greg Kelley. I'm a student in college. I'm currently studying Visual Basic.Net. I have a project that I'm working on, and I'm having some problems bringing it all together.I need to create a program that contains the following:
Menu System Required
Merge(2)Files together
Sort the File(First six characters)
Encrypt the file
Decrypt the file
Note: The file must contain 10 records(80 bytes long)
If you could asssist me in this , it would be greatly appreciated. If so, I need to do this in its simpliest form.
Thanks,
Greg Kelley
Greg Kelley
|
|
|
|
|
What are you having problems with? Menus, Merge, Sort, Encrypt/Decrypt??
RageInTheMachine9532
|
|
|
|
|
Thanks for responding. Well to be honest. I having problems with all of those.
This program doesn't have to be complex. Unfortunately, i had some personal issues that required to be absent for the class when all of the above was covered. I've been trying to contruct this on my own but haven't had much success. Your help would greatly be appreciated!!!!
Thanks
Greg Kelley
Greg Kelley
|
|
|
|
|
Buddy, we can help you here, but I think that's your homework. Send me the code you've already done, and I'll give you some help with it.
Free your mind...
|
|
|
|
|
Here is what i've done so far.
'Greg Kelley
'VB Program
'1-9-04
Module Module1
Sub Main()
'Read the contents of File1 to end of file and close.
Dim File1 As New System.IO.StreamReader("c:\words.txt")
Dim word1 As String = File1.ReadToEnd()
File1.Close()
'Reads the content of File2 to end of file and close.
Dim file2 As New System.IO.StreamReader("c:\test.txt")
Dim word2 As String = file2.ReadToEnd()
file2.Close()
'Merges the contents of file1 and file2 into File3 and closes.
Dim File3 As New System.IO.StreamWriter("c:\main.txt,")
File3.WriteLine(word1 & word2)
File3.Close()
End Sub
' Encrypts/decrypts the passed string using
' a simple ASCII value-swapping algorithm
Public Function SimpleCrypt(ByVal Main As String) As String
Dim X As String, i As Integer
' Encrypt
X = SimpleCrypt(Main)
MessageBox.Show(Main)
' Decrypt
X = SimpleCrypt(Main)
MessageBox.Show(Main)
For i = 1 To Len(Main)
If Asc(Mid$(Main, i, 1)) < 128 Then
File3 = _
CType(Asc(Mid$(Main, i, 1)) + 128, String)
ElseIf Asc(Mid$(Main, i, 1)) > 128 Then
File3 = _
CType(Asc(Mid$(Main, i, 1)) - 128, String)
End If
Mid$(Main, i, 1) = _
Chr(CType(File3, Integer))
Next i
Return Main
End Function
End Module
Greg Kelley
|
|
|
|