Click here to Skip to main content
15,946,316 members
Home / Discussions / Visual Basic
   

Visual Basic

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder12-Jul-09 22:40
cofounderChris Maunder12-Jul-09 22:40 
PinnedHow to get an answer to your question PinPopular
Chris Maunder10-Nov-05 16:30
cofounderChris Maunder10-Nov-05 16:30 
Questionvb.net mysql javascript Pin
AMRO DAMMAM15-Jul-24 20:05
AMRO DAMMAM15-Jul-24 20:05 
Public Sub FetchDataByName(customerName As String)
       ' Show debugging message
       MessageBox.Show("FetchDataByName called with Name: " & customerName)

       ' Replace with your actual MySQL connection details
       Dim connectionString As String = "Server=localhost;Port=3306;Database=MyData;Uid=asmgssl;Pwd=0786;"
       Dim query As String = "SELECT * FROM customer WHERE cname = @cname"

       Try
           Using connection As New MySqlConnection(connectionString)
               connection.Open()
               Using command As New MySqlCommand(query, connection)
                   command.Parameters.AddWithValue("@cname", customerName)
                   Using reader As MySqlDataReader = command.ExecuteReader()
                       ' Process query result
                       If reader.Read() Then
                           ' Example: Retrieve data and show in message box
                           Dim customerId As Integer = reader.GetInt32("id")
                           Dim customerAddress As String = reader.GetString("address")
                           MessageBox.Show($"Customer ID: {customerId}, Address: {customerAddress}")
                       Else
                           MessageBox.Show("No data found for Name: " & customerName)
                       End If
                   End Using
               End Using
           End Using
       Catch ex As Exception
           MessageBox.Show("Error fetching data: " & ex.Message)
       End Try
   End Sub

   Private Sub LoadHtmlContent()
       ' Define the HTML content
       Dim html As String = "<!DOCTYPE html>" &
                        "<html>" &
                        "<head>" &
                        "<title>Test Page</title>" &
                        "<script type='text/javascript'>" &
                        "function FetchDataByName() {" &
                        "    if (window.external && typeof window.external.FetchDataByName === 'function') {" &
                        "        var customerName = document.getElementById('inputName').value;" &
                        "        console.log('Fetching data for customer name: ' + customerName);" &
                        "        window.external.FetchDataByName(customerName);" &
                        "    } else {" &
                        "        console.error('window.external.FetchDataByName is not available.');" &
                        "    }" &
                        "}" &
                        "</script>" &
                        "</head>" &
                        "<body>" &
                        "<h1>Test Page</h1>" &
                        "<input type='text' id='inputName' placeholder='Enter Customer Name'>" & ' Changed id to inputName and placeholder text
                        "<button onclick='FetchDataByName()'>Fetch Data</button>" &
                        "</body>" &
                        "</html>"

       ' Load the HTML content into the WebBrowser control
       WebBrowser1.DocumentText = html
   End Sub


not fetch data
AnswerRe: vb.net mysql javascript Pin
Victor Nijegorodov15-Jul-24 21:18
Victor Nijegorodov15-Jul-24 21:18 
AnswerRe: vb.net mysql javascript Pin
Dave Kreskowiak16-Jul-24 4:20
mveDave Kreskowiak16-Jul-24 4:20 
QuestionHow to install Visual basic 6.0 PRO or Visual studio 6.0 using vbinstaller Pin
Blue Moon 202111-Jul-24 21:58
Blue Moon 202111-Jul-24 21:58 
AnswerRe: How to install Visual basic 6.0 PRO or Visual studio 6.0 using vbinstaller Pin
Dave Kreskowiak13-Jul-24 8:59
mveDave Kreskowiak13-Jul-24 8:59 
AnswerRe: How to install Visual basic 6.0 PRO or Visual studio 6.0 using vbinstaller Pin
gvidali15-Jul-24 5:05
gvidali15-Jul-24 5:05 
Questionsimple code ,how i can connect and read record from table in SQL database (VB.NET) Pin
Member 162990357-Jul-24 21:13
Member 162990357-Jul-24 21:13 
AnswerRe: simple code ,how i can connect and read record from table in SQL database (VB.NET) Pin
gvidali8-Jul-24 5:10
gvidali8-Jul-24 5:10 
QuestionHow to use web services in vb.net Pin
yvesauff15-Apr-24 5:15
yvesauff15-Apr-24 5:15 
AnswerRe: How to use web services in vb.net Pin
Dave Kreskowiak15-Apr-24 6:35
mveDave Kreskowiak15-Apr-24 6:35 
QuestionSelected row always visible in datagridview research Pin
medi dimie2-Mar-24 1:53
medi dimie2-Mar-24 1:53 
AnswerRe: Selected row always visible in datagridview research Pin
Richard MacCutchan2-Mar-24 2:58
mveRichard MacCutchan2-Mar-24 2:58 
QuestionResearch in datagridview Pin
medi dimie2-Mar-24 0:52
medi dimie2-Mar-24 0:52 
AnswerRe: Research in datagridview Pin
Richard Deeming3-Mar-24 22:01
mveRichard Deeming3-Mar-24 22:01 
QuestionMy problem is with the Next button. At the last rows, this message appears : System.ArgumentOutOfRangeException: 'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index' Pin
anis7831-Jan-24 1:46
anis7831-Jan-24 1:46 
AnswerRe: At the last rows, this message appears : System.ArgumentOutOfRangeException Pin
Richard MacCutchan31-Jan-24 2:00
mveRichard MacCutchan31-Jan-24 2:00 
GeneralRe: At the last rows, this message appears : System.ArgumentOutOfRangeException Pin
anis7831-Jan-24 2:37
anis7831-Jan-24 2:37 
GeneralRe: At the last rows, this message appears : System.ArgumentOutOfRangeException Pin
Richard MacCutchan31-Jan-24 2:51
mveRichard MacCutchan31-Jan-24 2:51 
GeneralRe: At the last rows, this message appears : System.ArgumentOutOfRangeException Pin
gvidali2-Feb-24 4:51
gvidali2-Feb-24 4:51 
QuestionVB6 printing bitmap or image on a POS Printer Pin
Member 1491430129-Jan-24 23:37
Member 1491430129-Jan-24 23:37 
AnswerRe: VB6 printing bitmap or image on a POS Printer Pin
RedDk30-Jan-24 8:52
RedDk30-Jan-24 8:52 
GeneralRe: VB6 printing bitmap or image on a POS Printer Pin
Member 1491430130-Jan-24 20:00
Member 1491430130-Jan-24 20:00 
AnswerRe: VB6 printing bitmap or image on a POS Printer Pin
Gerry Schmitz31-Jan-24 8:49
mveGerry Schmitz31-Jan-24 8:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.