Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,474 members, 7,819,725 topics. Date: Monday, 06 May 2024 at 09:46 PM

Back & New. Please Post Your Vb.net Problems - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Back & New. Please Post Your Vb.net Problems (2929 Views)

I Need A Help To Write A Simple Login Form Using Vb.net / Please Post All Your Java Programing Questions Here. / Post Ur Vb 6.0 Questions Here (2) (3) (4)

(1) (Reply) (Go Down)

Back & New. Please Post Your Vb.net Problems by luckyCO(m): 8:20pm On Nov 21, 2011
Hello
You can post your vb.net problems here.
Thanks
Re: Back & New. Please Post Your Vb.net Problems by Elprinz(m): 11:33pm On Nov 28, 2011
i have a problem
I am trying to retrieve images and their descriptions from database to appear "onmouseover" a text.
using vb.net
Re: Back & New. Please Post Your Vb.net Problems by luckyCO(m): 6:26am On Nov 29, 2011
El prinz:

i have a problem
I am trying to retrieve images and their descriptions from database to appear "onmouseover" a text.
using vb.net


Before saving to database use the code below and concert your picture to base64string and save.

Public Function Base64Encode(ByVal filepath As String, ByRef decodedData As String) As String

Try

If (Not String.IsNullOrEmpty(filepath)) Then


Dim fs As New FileStream(filepath, FileMode.Open, FileAccess.Read)

Dim filebytes(fs.Length - 1) As Byte

fs.Read(filebytes, 0, Convert.ToInt32(fs.Length))

decodedData = Convert.ToBase64String(filebytes, Base64FormattingOptions.InsertLineBreaks)

Return decodedData
Else
Return ""
End If


Catch ex As Exception
Return ""
End Try
End Function


To retrieve

Use the code below to reconvert from base64toimage

Public Function Base64Decode(ByVal Outputfilepath As String, ByVal encodedeData As String) As Boolean

Try

If (Not String.IsNullOrEmpty(Outputfilepath)) Then

Dim filebytes() As Byte = Convert.FromBase64String(encodedeData)

Dim fs As New FileStream(Outputfilepath, FileMode.CreateNew, FileAccess.Write, FileShare.None)

fs.Write(filebytes, 0, filebytes.Length)

fs.Close()
End If

Return True
Catch ex As Exception
Return False
End Try

End Function

Then apply this code

Picturebox1.image=image.loadfromfile(Outputfilepath ) ' please check loadfromfile for spelling

Then description Picturebox1.tooltiptext="Whatever you like"

Then goto picturebox1 hover event and set any picture you want for the systenm to display each time you hovers the image. It could be the above picture.

Hope it helps.
Re: Back & New. Please Post Your Vb.net Problems by kodewrita(m): 8:30am On Nov 29, 2011
Apologies for all deleted comments. This thread is now being maintained as a VB.NET wiki of sorts. All non-topic comments will no longer be allowed on this thread except requests for help or replies to help requests.

My apologies to Beaf, odiaero, Femi and the others.
Re: Back & New. Please Post Your Vb.net Problems by Beaf: 10:42am On Nov 29, 2011
kodewrita:

Apologies for all deleted comments. This thread is now being maintained as a VB.NET wiki of sorts. All non-topic comments will no longer be allowed on this thread except requests for help or replies to help requests.

My apologies to Beaf, odiaero, Femi and the others.

Dude, you win the trophy of best mod ever for your politeness and humble approach. I no go yab you for politics section again. grin
Seriously though, I am impressed, too few Nigerians have this approach.
Re: Back & New. Please Post Your Vb.net Problems by luckyCO(m): 10:30am On Nov 30, 2011
Thank you.
Am happy and also waiting for your questions.
Re: Back & New. Please Post Your Vb.net Problems by Elprinz(m): 12:14pm On Dec 02, 2011
luckyCO:


Before saving to database use the code below and concert your picture to base64string and save.

Public Function Base64Encode(ByVal filepath As String, ByRef decodedData As String) As String

Try

If (Not String.IsNullOrEmpty(filepath)) Then


Dim fs As New FileStream(filepath, FileMode.Open, FileAccess.Read)

Dim filebytes(fs.Length - 1) As Byte

fs.Read(filebytes, 0, Convert.ToInt32(fs.Length))

decodedData = Convert.ToBase64String(filebytes, Base64FormattingOptions.InsertLineBreaks)

Return decodedData
Else
Return ""
End If


Catch ex As Exception
Return ""
End Try
End Function


To retrieve

Use the code below to reconvert from base64toimage

Public Function Base64Decode(ByVal Outputfilepath As String, ByVal encodedeData As String) As Boolean

Try

If (Not String.IsNullOrEmpty(Outputfilepath)) Then

Dim filebytes() As Byte = Convert.FromBase64String(encodedeData)

Dim fs As New FileStream(Outputfilepath, FileMode.CreateNew, FileAccess.Write, FileShare.None)

fs.Write(filebytes, 0, filebytes.Length)

fs.Close()
End If

Return True
Catch ex As Exception
Return False
End Try

End Function

Then apply this code

Picturebox1.image=image.loadfromfile(Outputfilepath ) ' please check loadfromfile for spelling

Then description Picturebox1.tooltiptext="Whatever you like"

Then goto picturebox1 hover event and set any picture you want for the systenm to display each time you hovers the image. It could be the above picture.

Hope it helps.




thanks mate
Re: Back & New. Please Post Your Vb.net Problems by luckyCO(m): 6:49pm On Dec 02, 2011
good any more?
Re: Back & New. Please Post Your Vb.net Problems by Elprinz(m): 10:01pm On Dec 02, 2011
[size=16pt]Append to Label on gridview[/size]

I am working with a gridview and an ajax accordion menu

I have labels on both and would like to loop through a dataset and load on this labels the count with respect
to the Id of each category as stored in sql database.

for example

Category Name No of items
Football (14)
baseball (10)
and so on

i have a stored procedure (Select Count(*) front CategoryTable where catId = @catId) -----not sure if this will do the job

then how do i bind this to the label on the gridview

The image below is a representation of how i want it to

pls help

Re: Back & New. Please Post Your Vb.net Problems by luckyCO(m): 12:50pm On Dec 03, 2011
You can use grid view template to bind label control. But I dont know why you want to use Label instead of text the system has provide and make it readonly?
Re: Back & New. Please Post Your Vb.net Problems by gadoonline(m): 11:41am On Dec 12, 2011
Please i need your help i have downloaded the sql server 2008 in the sql server configuration manager if i want to start the sql server agent it give me error massage like this (the remote procedure call failed.[0x800706be]
Re: Back & New. Please Post Your Vb.net Problems by luckyCO(m): 10:02am On Dec 14, 2011
gadoonline:

Please i need your help i have downloaded the sql server 2008 in the sql server configuration manager if i want to start the sql server agent it give me error massage like this (the remote procedure call failed.[0x800706be]

It maybe you didn't have a clean installation on your machine.
Check installation manual and compatibility check.
It will guide you on what you need to instal base on your OS/64 or 32bit computers.
Re: Back & New. Please Post Your Vb.net Problems by gadoonline(m): 9:40am On Dec 16, 2011
luckyCO:

It maybe you didn't have a clean installation on your machine.
Check installation manual and compatibility check.
It will guide you on what you need to instal base on your OS/64 or 32bit computers.



Thank you luckyco i have re install the software and it work fine
Re: Back & New. Please Post Your Vb.net Problems by luckyCO(m): 11:45am On Dec 19, 2011
Thank God
Re: Back & New. Please Post Your Vb.net Problems by luckyCO(m): 3:31pm On May 16, 2019
luckyCO:
Hello
You can post your vb.net problems here.
Thanks

Hello
Am back, was out for a while.
Am waiting for assistance on any vb.net issues.
Please be concise am not going to help you if you are looking for someone who will be coming to teach you programming.
I can help programmers of vb.net get to their destinations based on the time I have now.
Thank you
Re: Back & New. Please Post Your Vb.net Problems by luckyCO(m): 3:08pm On May 19, 2019
Still open to help.
Re: Back & New. Please Post Your Vb.net Problems by luckyCO(m): 10:03am On May 23, 2019
The code below will extract sql from a class

You need to import Imports System.Reflection

Public Class tsDataEntry
Dim _Surname As String
Dim _Firstname As String
Dim _Age As Integer
Dim _Address As String
Dim _sysID As Integer

Property sysID As Integer
Get
Return _sysID
End Get
Set(value As Integer)
_sysID = value
End Set
End Property

Property Surname As String
Get
Return _Surname
End Get
Set(value As String)
_Surname = value
End Set
End Property

Property Firstname As String
Get
Return _Firstname
End Get
Set(value As String)
_Firstname = value
End Set
End Property

Property Age As Integer
Get
Return _Age
End Get
Set(value As Integer)
_Age = value
End Set
End Property

Property Address As String
Get
Return _Address
End Get
Set(value As String)
_Address = value
End Set
End Property

End Class

Sub ProcessForm()
Dim tsReg As New tsDataEntry
tsReg.Address = "Lagos"
tsReg.Age = 34
tsReg.Surname = "Ayo"
tsReg.Firstname = "Mercy"

Dim Fvalues As String = ""
Dim FNames As String = ""
Dim UpdateScript As String = ""

Dim sqlInsert As String
Dim sqlUpdate As String

getSQlFromClass(tsReg, FNames, Fvalues, UpdateScript)
sqlInsert = "Insert into tablename (" & FNames & "wink Values (" & Fvalues & "wink"

sqlUpdate = "Update tablename set "& UpdateScript & " where sysID=" & tsReg.sysID)

End Sub

Public Sub getSQlFromClass(ts As Object, ByRef FN As String, ByRef FV As String, Optional ByRef uscript As String = ""wink
Dim t As Type
t = ts.GetType
Dim Sql As String = ""
FN = ""
FV = ""
uscript = ""

Dim fn1 As String = ""
Dim fv1 As String = ""

Dim ColumnNameNotWantedFromTheClass As String = "username,password".ToUpper
Dim col() As String = Split(ColumnNameNotWantedFromTheClass, ","wink

Dim mp As PropertyInfo
For Each mp In t.GetProperties


If col.Contains(mp.Name.ToString.ToUpper) = True Then GoTo 60


Try
If String.IsNullOrEmpty(FN) = True Then

If mp.PropertyType Is GetType(Int16) OrElse mp.PropertyType Is GetType(Int32) OrElse _
mp.PropertyType Is GetType(Int64) OrElse mp.PropertyType Is GetType(Integer) OrElse _
mp.PropertyType Is GetType(Decimal) OrElse mp.PropertyType Is GetType(Double) Then

FV = Val(mp.GetValue(ts, Nothing))

ElseIf mp.PropertyType Is GetType(Boolean) Then
Dim iret As Boolean = mp.GetValue(ts, Nothing)
If iret = True Then
FV = "1"
Else
FV = "0"
End If
Else

Try
FV = "'" & mp.GetValue(ts, Nothing) & "'"
Catch ex As Exception
FV = "'0000-00-00'"
End Try


End If


FN = mp.Name
uscript = FN & "=" & FV

Else

If mp.PropertyType Is GetType(Int16) OrElse mp.PropertyType Is GetType(Int32) OrElse _
mp.PropertyType Is GetType(Int64) OrElse mp.PropertyType Is GetType(Integer) OrElse _
mp.PropertyType Is GetType(Decimal) OrElse mp.PropertyType Is GetType(Double) Then

fv1 = Val(mp.GetValue(ts, Nothing))

ElseIf mp.PropertyType Is GetType(Boolean) Then
Dim iret As Boolean = mp.GetValue(ts, Nothing)
If iret = True Then
fv1 = "1"
Else
fv1 = "0"
End If
Else
Try
fv1 = "'" & mp.GetValue(ts, Nothing) & "'"
Catch ex As Exception
fv1 = "'0000-00-00'"
End Try

End If

fn1 = mp.Name

FN &= "," & fn1
FV &= "," & fv1

uscript &= "," & fn1 & "=" & fv1

End If

Catch ex As Exception

End Try

60: Next

End Sub

(1) (Reply)

Does Anyone Know How To Write A Computer Program On An INTEGRATED CIRCUIT (IC) / Linux Users In Nigeria / Who Built Theses Apps. Wificall App, Oride App, And Kobo360 App

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 39
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.