where & is used for a small Underline only one first text look up. Then you need to change the lable1 name to User Name and label2 to Password then for the Buttons change the button1 right-click property to show text select button1 and type &Log In and button2 &Cancel. If you wish you can set the form1 name my form1 name is “Log in Form”.Ĭlick the Toolbox and drag and drop two buttons and two labels and two TextBoxes as in the following: Set the Windows Forms form name and show text in the specified properties. You can set the size and if you want to set the size by properties then right-click on the Windows Forms form and in the last option of show properties click to see the Windows Forms form properties. In your Windows Forms form set the size as needed. You can change the name as you wish or as per program creation you can mention and click and OK.Īfter clicking OK a simple Windows Forms form will look like: In the following see the Name label and already show the default name WindowFormsApplication7. In Installed Templates the first option is Visual C# language and then select Windows Forms application. When open it will look like this:Ĭlick on the middle tab of new project. Open any version of Visual Studio you have installed in your machine I have Visual Studio 10. LblMessage.Text = "File format not recognised.The following procedure shows how to create a login form in Visual Studio and connect with SQL Server in 10 steps. LblMessage.Text = "File Uploaded Successfully" & " values cmd As New SqlCommand(strQuery)Ĭmd.Parameters.Add( SqlDbType.VarChar).Value = filenameĬmd.Parameters.Add( SqlDbType.VarChar).Value _Ĭmd.Parameters.Add( SqlDbType.Binary).Value = bytes 'Set the contenttype based on File Extensionĭim fs As Stream = ĭim bytes As Byte() = br.ReadBytes(fs.Length)ĭim strQuery As String = "insert into tblFiles" _ ' Read the file and convert it to Byte Arrayĭim filePath As String = ĭim filename As String = Path.GetFileName(filePath)ĭim ext As String = Path.GetExtension(filename) Protected Sub btnUpload_Click( ByVal sender As Object, ByVal e As EventArgs) LblMessage.Text = "File format not recognised." + " values cmd = new SqlCommand(strQuery) Ĭmd.Parameters.Add( SqlDbType.VarChar).Value = filename Ĭmd.Parameters.Add( SqlDbType.VarChar).ValueĬmd.Parameters.Add( SqlDbType.Binary).Value = bytes String strQuery = "insert into tblFiles(Name, ContentType, Data)" + Stream fs = īyte bytes = br.ReadBytes(( Int32)fs.Length) Set the contenttype based on File ExtensionĬontenttype = "application/vnd.ms-excel" String ext = Path.GetExtension(filename) String filename = Path.GetFileName(filePath) Read the file and convert it to Byte Array Protected void btnUpload_Click( object sender, EventArgs e)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |