Hi guys , i trying to develop an app for my son so he can easily admin a mysql database , and after lots of googleing i eventually came across brandons youtube tutorials on sql connection .. Thanks for those man , very helpful.
I have progressed quite well but it seems i have over looked something.
I wanted to make the app useful to others so rather than predetermine the connection string i thought to add simple textbox entries for connection to other DB's of this nature.
Ok so to my problem . to aid in debugging i predetermined the connection string variables to save me typing them in. Now that im ready to try the app i remove the predetermined variable strings and want the textbox entries to come into play.
heres my code :
[code2=vbnet]Imports MySql.Data.MySqlClient
Public Class Form1
'common variables
Public Shared IP As String = "removed for security"
Public Shared DBNAME As String = "removed for security"
Public Shared USER As String = "removed for security"
Public Shared PASS As String = "removed for security"
Public Shared conn_ok As Boolean = False
Public Shared connstr As String = "Server=" & IP & ";Database=" & DBNAME & ";Uid=" & USER & ";Pwd=" & PASS & ";"
Public Shared myConnection As New MySqlConnection(connstr)
Public Shared command As New MySqlCommand
Public Shared adapter As New MySqlDataAdapter
Public Shared data As MySqlDataReader
'connection code
'ip address
Private Sub KryptonTextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles KryptonTextBox1.TextChanged
IP = KryptonTextBox1.Text
connstr = "Server=" & IP & ";Database=" & DBNAME & ";Uid=" & USER & ";Pwd=" & PASS & ";"
End Sub
'Database name
Private Sub KryptonTextBox2_TextChanged(sender As System.Object, e As System.EventArgs) Handles KryptonTextBox2.TextChanged
DBNAME = KryptonTextBox2.Text
End Sub
'username
Private Sub KryptonTextBox3_TextChanged(sender As System.Object, e As System.EventArgs) Handles KryptonTextBox3.TextChanged
USER = KryptonTextBox3.Text
End Sub
'password
Private Sub KryptonTextBox4_TextChanged(sender As System.Object, e As System.EventArgs) Handles KryptonTextBox4.TextChanged
PASS = KryptonTextBox4.Text
End Sub
'connection test
Private Sub KryptonButton1_Click(sender As System.Object, e As System.EventArgs) Handles KryptonButton1.Click
' check connection by retrieving sql version
KryptonRichTextBox1.Text = ""
Dim stm As String = "SELECT VERSION()"
Dim Version As String = ""
Try
myConnection.Open()
TextBox1.Text = "Server=" & IP & ";Database=" & DBNAME & ";Uid=" & USER & ";Pwd=" & PASS & ";"
Dim cmd As MySqlCommand = New MySqlCommand(stm, myConnection)
Version = Convert.ToString(cmd.ExecuteScalar())
KryptonRichTextBox1.Text = "Successful connection : connected to PermissionsEx database version : " & Version
conn_ok = True
Catch ex As MySqlException
KryptonRichTextBox1.Text = "Connection Error : Please verify your database info is correct and your internet connection is valid."
conn_ok = False
TextBox1.Text = "Server=" & IP & ";Database=" & DBNAME & ";Uid=" & USER & ";Pwd=" & PASS & ";"
Finally
myConnection.Close()
End Try
' if connection is ok then check db tables exist
If conn_ok = True Then
Try
Dim sqlquery As String = "SELECT * from permissions"
myConnection.Open()
command.CommandText = sqlquery
command.Connection = myConnection
adapter.SelectCommand = command
data = command.ExecuteReader
Catch extable As MySqlException
KryptonRichTextBox1.Text = "Successful connection : connected to mySQL database version : " & Version & ". However no Permissions EX tables are present , please check your database configuration."
Finally
myConnection.Close()
End Try
Else
KryptonRichTextBox1.Text = "Connection Error : Please verify your database info is correct and your internet connection is valid."
End If
End Sub[/code2]
The problem seems to be that if i run my app and hit my connect button without populating the textboxes it connects using my predetermined values no problems.
If i remove my predetermined values and rely on the textboxes connection fails.
I displayed the connection string in a new textbox to see what was going on , when i connect to the db my outputted textbox string is missing the variables , if i fail to connect using the textboxes , the connection string in the debug textbox is fine .
basically what im saying is i cannot seem to push the textbox entries into a successful connection string.
I need help this has to be before mothers day. Can anyone tell me the java code so I can make java read an audio file or is it the same as making it read a text file I am using eclipse
Hi guys! This is my first time posting here <!-- s --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="" title="Smile" /><!-- s -->
Although my progrma is still in development I wanted to share it. In short it's a kind of full screen dekstop interface (a bit like the windows 8 start screen). Alot of work still has to be done... Suggestions are welcome!
Features:
-Create infinite user accounts (saved as a 'username'.ac file)
-Password are encrypted in 'username'.ac file
-Snap to grid tiles at 'Platform'
A download link can be found here: <!-- m --><a class="postlink" href="http://netvos.zxq.net/download/v6.5.zip">http://netvos.zxq.net/download/v6.5.zip</a><!-- m -->
I'm slowly learning java, mostly from Brandonio21's videos, and I have run into a problem. I need to know what I need to do with this code:
[code2=java]package howto;
import javax.swing.JOptionPane;
public class Calculator {
public static void main(String[] args)
{
JOptionPane myIO = new JOptionPane();
double inputText = myIO.showInputDialog("Please enter length:");
double lingth = inputText;
double inputText1 = myIO.showInputDialog("Please enter length:");
double width = inputText1;
double area = (lingth * width) / 2;
JOptionPane.showMessageDialog(null, "The area of the triangle is: " + area);
}
}[/code2]
I need help soon because it is for a school project called "How to".
I am trying to make it so that a button remains held down rather then pressed using a timer, but I can't figure it out. If someone could tell me if this is possible or not I would appreciate it. Thanks!
Seems like it should be relatively simple, but I can't quite get it. I want to create a series of buttons that each play a random .wav file from a different category. I have all my .wav files grouped into different directories based on the button I want them to be associated with. I have been able to make a singular .wav file play when I click the button but I want it to be different audio file each time I click it.
Edit: I suppose I should mention that while I'm pretty good with a computer I'm COMPLETELY new to anything programming related. So just assume I know little to nothing when it comes to explaining things. Thanks for any help!
Except Brandonio's great videos, can please tell me reading/video materials. That are good too.
Best would be, basics and than jdbc.
Main thing, that i wan't to learn is make application (Chat) and use my design => <!-- m --><a class="postlink" href="http://screencloud.net/v/wQH9">http://screencloud.net/v/wQH9</a><!-- m -->
Terms? Things what i need to know? Tips?
I will appriciate all. <!-- s --><img src="{SMILIES_PATH}/icon_e_smile.gif" alt="" title="Smile" /><!-- s -->
Properties are essential if you are creating a custom object. Essentially, properties are the things that can be edited in the "visual designer" - all of the things that are accessible via the properties window in the lower right hand corner of Visual Studio.
Adding basic properties to your form is easy. All you need is an instance variable and a property block. Then you're all set. For example, here is a sample property arrangemenet:
[code2=vbnet]Private _messageString As String
Public Property MessageString As String
Get
Return _messageString
End Get
Set(value As String)
_messageString = value
End Set
End Property[/code2]
Of course, in this example we use a String object. In the real world, any object can be used. After this is added to your object, the user will be able to edit the properties via the properties Window and give this variable a specific value.
What if you wanted to give the user a list of options to choose from, though? This can be doing by combining properties with enumerations. Thus:
[code2=vbnet]Private _messageString As messageIdentifier
Public Property MessageString As messageIdentifier
Get
Return _messageString
End Get
Set(value As messageIdentifier)
_messageString = value
End Set
End Property
Enum messageIdentifier As Integer
Greetings = 1
Goodbyes = 2
Warning = 3
Declaration = 4
End Enum[/code2]
Although the above code snippet may seem rather ridiculous since the Enumerations don't actually correspond to anything, this is a way of offering the user a list of options to choose from. In this case, the list will contain "Greetings", "Goodbyes", "Warning", and "Declaration". You can then work with this choice by processing the enumeration in some way, as such:
[code2=vbnet]Private Function GetMessageString() As String
If (_messageString = messageIdentifier.Declaration) Then
Return "Of Independence"
ElseIf (_messageString = messageIdentifier.Goodbyes) Then
Return "It has been a fun time, but I must leave you."
ElseIf (_messageString = messageIdentifier.Greetings) Then
Return "Salutations, my good man/woman"
ElseIf (_messageString = messageIdentifier.Warning) Then
Return "Back off! You have no business in this area."
Else
Return ""
End If
End Function[/code2]
Thus, it is really easy to give the user the ability to edit properties when they add your custom control to their form. The only downside occurs when you update a property to be a different object, but do not change the value of the property. Massive errors ensue.
View the video here: <!-- m --><a class="postlink" href="http://www.youtube.com/watch?v=JAK6veamu8o&feature=youtu.be">http://www.youtube.com/watch?v=JAK6veam ... e=youtu.be</a><!-- m -->
Feel free to download a sample project:
[attachment=0]<!-- ia0 -->PropertyTutorial.zip<!-- ia0 -->[/attachment]
I know I have received several PMs and emails regarding making your VB.NET application start with Windows, and I finally got around to creating a nice code snippet.
The first thing you need to do is as the "Windows Script Host Object Model" COM object as a reference to your project. This is very important.
Next, you will want to import the reference:
[code2=vbnet]Imports IWshRuntimeLibrary[/code2]
Now you're good to go and you can start your application with Windows. Essentially, this code will create a shortcut in the users "Startup" folder, forcing Windows to start the application when the computer is turned on.
This code will create the shortcut/start the program with Windows:
[code2=vbnet]'create path variables
Dim startupPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Startup)
Dim executablePath As String = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName
Dim executableName As String = System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName
'create shortcut
Dim Shell As WshShell
Dim Link As WshShortcut
Try
Shell = New WshShell
Link = CType(Shell.CreateShortcut(startupPath & "\" & executableName & ".lnk"), IWshShortcut)
Link.TargetPath = executablePath
Link.Save()
Catch ex As Exception
MsgBox(ex.Message)
End Try[/code2]
This code will remove the shortcut/stop the program from starting with Windows:
[code2=vbnet]Dim startupPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Startup)
Dim executableName As String = System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName
Dim directoryInfo As New System.IO.DirectoryInfo(startupPath)
Dim fileInfo() As System.IO.FileInfo
fileInfo = directoryInfo.GetFiles("*.lnk")
For Each file As System.IO.FileInfo In fileInfo
If (file.FullName.Contains(executableName)) Then
file.Delete()
End If
Next[/code2]
Optionally, you can eliminate the deletion of files with similar names by changing file.FullName.Contains(executableName) to file.FullName.Equals(executableName)
Watch the video here: <!-- m --><a class="postlink" href="http://www.youtube.com/watch?v=VpPqPtTjMzQ&feature=youtu.be">http://www.youtube.com/watch?v=VpPqPtTj ... e=youtu.be</a><!-- m -->
I want to do some 'droid development and I'm looking for the best way to get up to speed quickly. Everybody says Java is the way to go, but I'd like to find a 'trail' that will get me there. "There's an app for that," right? I want to write some of those apps and publish them in the Play Store. Any suggestions?