646 Posted Topics
Re: Why don't you use [CODE=VB]MkDir "C:\TempDir"[/CODE] Ok. If you want to do it hard way: [CODE=VB]Private Declare Function CreateDirectory Lib "shell32.dll" Alias "SHCreateDirectoryExA" (ByVal hwnd As Long, ByVal pszPath As String, ByVal psa As Any) As Long CreateDirectory Me.hWnd, "C:\TempDir", Nothing[/CODE] just make sure to check return value for errors. | |
Re: LostFocus event might be better for your purposes: [ICODE]Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus[/ICODE] | |
Re: First you have to create a new table to your Access DB. You'll find the SQL syntax and samples with a little [URL="http://www.google.com/search?q=sql+create+table"]googling[/URL]. I think that the [URL="http://www.w3schools.com/Sql/sql_create_table.asp"]w3schools.com[/URL] has the simplest examples. And you do know the table's field names and types by looking existing tables. After successfully creating a … | |
Re: You have to loop the original string: [CODE=VB]Private Function InsertChar(ByVal StringIn As String, _ ByVal CharToInsert As String, _ ByVal InsPosition As Integer) As String Dim NewString As String Dim CharsUsed As Integer Dim i As Integer If InsPosition >= Len(StringIn) Then InsertChar = StringIn Exit Function End If NewString … | |
Re: The code won't open a file since it never gets any file name. Try it this way: [CODE=VB.NET]Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then WebBrowser1.Navigate(OpenFileDialog1.FileName) End If End Sub[/CODE] now it may or may not open and show the file … | |
Re: Since you have two different Availability values, you'll get two rows no matter what you do. Drop the dbo.RoomRates.Overflow = 1 check. Or use that query as a sub query: [CODE=SQL]SELECT DISTINCT dbo.RoomRates.RoomID, MIN(Availability) As Availability, SUM(RoomTotalPrice) AS RoomTotalPrice FROM (< your original query here >)[/CODE] | |
Re: The error message says it all, the argument has to be character: [CODE=VB.NET]strAthleteToken = strRecord.Split(CChar(","))[/CODE] and the [ICODE]strAthleteToken[/ICODE] must be a string array, not a string. | |
Re: In fact you have two different types. One Vertex type in your DLL namespace and another Vertex type in your main program's namespace. Since those are different types you can't do direct assignment. One way to get around "different types" problem could be following: [CODE=VB.NET]Dim VertObj As Object = DirectCast(method.Invoke(o, … | |
Re: Use the same handler to handle all three text boxes: [CODE=VB.NET]Private Sub ValidateNumbers(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged, TextBox3.TextChanged Dim ThisBox As TextBox ThisBox = CType(sender, TextBox) If ThisBox.Text <> "" Then If IsNumeric(ThisBox.Text) Then 'checks input for numeric value If CDbl(ThisBox.Text) <= 0 Then … | |
Re: OMG. Can't you fix the sp? Like "SELECT DISTINCT(SchoolChildID)..." or "SELECT DISTINCT(SchoolChild)..." | |
Re: You execute SQL query twice:[CODE=VB.NET] Dim obj As Byte() = CType(cmd.ExecuteScalar(), Byte()) Response.ContentType = "Application/msword" Response.BinaryWrite(CType(cmd.ExecuteScalar(), Byte()))[/CODE] How is your Doc stored in DB? As an image-type field? You may try to change latter cmd.ExecuteScalar to: [CODE=VB.NET]Response.BinaryWrite(obj)[/CODE] since obj should contain Doc-field as a byte array at that point. You … | |
Re: LinkLabel control has a click event. Am I missing something :-/ | |
Re: In the VB.NET code I would still stick in SQLDMO to fetch any information. | |
Re: ToString() gives the textual respresentation of the object. This means with numbers that, for example, number 3 gets displayd as string "3". ToString() also accepts format string as a parameter and this gives the full power of it. For example -123.ToString("X") returns hexadecimal representation of the number (=FFFFFF85). You can … | |
Re: [ICODE]"SELECT [User_Name],[Password],[User_Type] FROM Log_in WHERE [User_Name] = @UserName AND [Password] = @UserPassword "[/ICODE] and then check which User_Type this user has. I won't correct the rest of your code, you can surely do it yourself. | |
Re: Here you are: [CODE=VB6] Dim LoanDate As Date Dim LoanDays As Integer Dim DueDate As Date Dim DiffDays As Long Dim Fine As Single Dim Total As Single ' When loaned LoanDate = CDate("8.10.2008") ' How many days can be loaned LoanDays = 3 ' When the loan time ends … | |
Re: [QUOTE]i'm getting the graphic from the book's cd--but i'm having all types of problems getting it to copy[/QUOTE] What are all types of problems? You're working with localhost? Your localhost resides on "D:\Inetpub\wwwroot" (this is my computer so your could be "C:\..." or something else). You've created a web-project "local". … | |
Re: Try to also set rs and con to Nothing. You may also get that error from target file i.e. you don't have write permission to D:\Person.mdb or D:\Person.mdb is opened in your application or in some other application. | |
Re: You'll get that with ListView control. Fill ListView control: [CODE=VB.NET]Dim TempStr(1) As String Dim NewNode As ListViewItem ListView1.View = View.Details ' FullRowSelect has to be True ListView1.FullRowSelect = True ListView1.Columns.Clear() ListView1.Columns.Add("Column1", 100) ListView1.Columns.Add("Column2", 100) ListView1.Items.Clear() TempStr(0) = "foo" TempStr(1) = "bar" NewNode = New ListViewItem(TempStr) ListView1.Items.Add(NewNode) TempStr(0) = "another" TempStr(1) … | |
Re: Are you taking course on Visual Basic? AFAIK connecting with RMI or socket has something to do with Java :-O | |
Re: Assuming you can convert start and ending times to valid dates, use DateDiff with "n" which gives you minutes: [CODE=VB.NET] Dim d1 As Date Dim d2 As Date Dim DiffMinutes As Long d1 = CDate("1.1.2008 23:00") d2 = CDate("2.1.2008 1:00") DiffMinutes = DateDiff("n", d1, d2)[/CODE] gives DiffMinutes = 120. Date … | |
Re: Here's a snippet from some old prog of mine: [CODE=VB6]Private Declare Function GetComputerName Lib "kernel32" Alias _ "GetComputerNameA" (ByVal lpBuffer As String, ByRef nSize As Long) As Long Public Function GetThisComputerName(ByRef ComputerName As String) As Boolean ' Returns Computer name Dim lpBuffer As String Dim i As Long Const BUFMAXLENGTH … | |
Re: Use arrays or collections. Maybe even dictionary might work in that. But maybe a simple array will do (pseudo code): [CODE]Const TotalOptions = 5600 Dim GrossPay(TotalOptions) As Single Dim Deduct(TotalOptions) As Single ' Fill arrays with proper values, GrossPay in increasing order and Deduct with matching index with GrossPay GrossPay(1) … | |
Re: You'll get it with: [CODE=VB.NET]Dim Resp As System.Net.HttpWebResponse ' Make WebRequest ' Resp.Cookies has the cookies[/CODE] Take a look at [ICODE]System.Net.WebResponse[/ICODE] and [ICODE]System.Net.HttpWebResponse[/ICODE] namespaces. You should find everything you need in them (and in Request namespaces of cource). | |
Re: How about a bit googling [URL="http://www.google.com/search?q="ms+access"+"vb.net"+tutorial"]http://www.google.com/search?q="ms+access"+"vb.net"+tutorial[/URL] | |
Re: In the .NET way: [CODE=VB.NET]If datgridview.item(x,y).value.tostring.substring.Length > 0 Then datgridview.item(x,y).value = datgridview.item(x,y).value.tostring.substring(0, datgridview.item(x,y).value.tostring.Length - 1) End If[/CODE] | |
Re: Take a look at [URL="http://sqlite.org/"]SQLite[/URL] and [URL="http://sqlite.phxsoftware.com/"]System.Data.SQLite[/URL] for .NET environment. If you find it useful for your purposes, the freeware version of [URL="http://osenvistasuite.com/"]OsenXPSuite[/URL] is a pretty good database designer. | |
Re: If your class is part of a windows GUI application you won't even need to import that namespace and your code works. So I assume you're creating a standalone dll. First you have to add reference to System.Windows.Forms.dll. From "Project"-menu select "Add Reference". From ".NET"-tab locate System.Windows.Forms, select it and … | |
Re: [QUOTE]The constructor for the class should set the initial fuel level to 0.0[/QUOTE] Your school assignment states clearly what you should do: [CODE=VB6]Private FuelLevel As Double Private Sub Class_Initialize() FuelLevel = 0 End Sub[/CODE] You can't initialize variables outside of the procedures like smile4evr said. | |
Re: If I remember right, the connection string is following: [CODE]"Driver= {MicrosoftAccessDriver(*.mdb)}; DBQ=" & server.mappath("Record.mdb") & "; Uid=Username; Pwd=Password;"[/CODE] One way to use MySQL in VB6 is to get MySQL ODBC driver (from MySQL site). The connection string is following: [CODE]"DRIVER={MySQL ODBC 3.51 Driver}; SERVER=127.0.0.1; DATABASE=MySample; UID=UserName; PWD=Password"[/CODE] You may find … | |
Re: It goes like this: [CODE=VB.NET] Dim comando As OleDb.OleDbCommand() Dim strSQL As String strSQL = "Insert into personaldata (name,occupation,address,phone) values (" strSQL = strSQL & "'" & getname() & "'," strSQL = strSQL & "'" & getoccupation() & "'," strSQL = strSQL & "'" & getaddress() & "'," strSQL = … | |
Re: If you mean with keypad those keys on the right side of the (standard) keyboard, just press Num Lock. If you want to do that programmatically, see: [URL="http://forums.devx.com/archive/index.php/t-38468.html"]Turn Num Lock, Caps Lock keys on and off with VB6[/URL] and you will probably forget that keypad thing :D | |
Re: [QUOTE]ByVal SFNInvestmentsBankAccountInfo() As SFNInvestmentBankAccountInfoType[/QUOTE] means that an array of SFNInvestmentsBankAccountInfoType should be passed to web method. Also the result is an array: [CODE=VB.NET] Dim myresult() As localhost.ResponseType Dim bankinfo(0) As New localhost.SFNInvestmentBankAccountInfoType . . bankinfo(0).BankAccountName = "ACME Systems Chemical Combine" . . bankinfo(0).versionID = "10001" myresult = wb.createBankAccountInformation(bankinfo)[/CODE] | |
Re: You may want to check that when user presses Ok-button (or any similar button): [CODE=VB.NET]Private Sub cmdOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOk.Click ' Check empty text If Me.txtInterestRate.Text.Trim = "" Then MessageBox.Show("Please enter interest rate", _ "Missing Information", _ MessageBoxButtons.OK, _ MessageBoxIcon.Warning) Me.txtInterestRate.Focus() ' Set focus … | |
Re: That's a quite large topic. Normal scope/out of scope rules apply to variables i.e. when (local) variable goes out of scope, it's destroyed automatically. Class implementations should implement destructor (Class_Terminate event) to clean up allocated resources. The same applies to every reference you make to resources, like database connection objects. … | |
Re: Have you created streamfilewrite object somewhere? Like this: [CODE=VB.NET]Dim streamfilewrite As FileStream streamfilewrite = New FileStream("<path to file>", FileMode.Open) [/CODE] | |
Re: I think it goes like this with ADO: [CODE=VB6]Datacontrol.Recordset.AddNew 'Datacontrol.Recordset.Fields("<fieldname>") = <value> Datacontrol.Recordset.Update[/CODE] | |
Re: What error message exactly? Do you have CN open? [CODE=VB]Dim CN As ADODB.Connection CN = New ADODB.Connection CN.Open "<connection string>"[/CODE] Also the recordset could be empty: [CODE=VB]If RS.Fields.Count > 0 Then Label7.Caption = RS.Fields(0) Else Label7.Caption = "" End If[/CODE] | |
Re: What kind of VB.NET exe and what kind of parameters you have? You could write parameters to a some file and pass the file's name to exe with commandline. If you have only few parameters, put them to exe's commandline. And here's how to deal with cmd-line in VB.NET: [CODE=VB.NET]For … | |
Re: Not sure if this is even close with what you want: [CODE=VB6]Dim strSQL As String Dim oConn As ADODB.Connection Dim Rs As RecordSet oConn = CreateObject("ADODB.Connection") oConn.Open("<conn string>") strSQL = "INSERT INTO <Table Name> (<fields>) VALUES (<field values); SELECT @@IDENTITY AS 'Identity' " Rs = oConn.Execute(strSQL) Print(Rs(0))[/CODE] What it does … | |
Re: You can use comma as a separator but you should enclose text in quotes, like this: 'One text field' | |
Re: If you don't need to export directly to native xls-file, one way is to use CSV-file: [CODE=VB.NET]Dim OutFile As StringBuilder Dim SepChar As String Dim i As Integer Dim j As Integer OutFile = New StringBuilder() SepChar = "," For i = 0 To DataGridView1.RowCount - 1 ' Columns of … | |
Re: [QUOTE]one more question, is replace function case sensitive?[/QUOTE] By default, yes. Unless you have [CODE]Option Compare Text[/CODE] Here's an example [CODE]Dim str As String str = "ABC" str = Replace(str, "b", "x", , , vbBinaryCompare) [/CODE]results "ABC" and vbBinaryCompare is the default compare method in VB6 [CODE]str = Replace(str, "b", … | |
Re: Check My.Application.OpenForms collection: [CODE=VB.NET]Public Function FormsRunning(ByVal FormName As String) As Integer ' Return number of forms with name FormName in this application Dim Count As Integer Dim i As Integer Count = 0 For i = 0 To My.Application.OpenForms.Count - 1 If My.Application.OpenForms.Item(i).Text = FormName Then Count += 1 End … | |
Re: Yes, there is a way. First, here's a sample Account and Accounts (without any error handling): [CODE=VB.NET]Option Explicit On Option Strict On Public Class Account Private _Name As String Public Property Name() As String Get Return _Name End Get Set(ByVal value As String) _Name = value End Set End Property … | |
Re: Which part is not working? What error do you get? At least using TextBox1.Text in both SET and WHERE seems a bit suspicious. If roll exists, you update roll-field with the same value it already has. If roll does not exists, then your update fails. Also, open connection before you … | |
Re: What error message do you get? Does this work in your code: [CODE=VB.NET]Dim oConn As OleDbConnection Dim oCmd As OleDbCommand Dim strSQL As String Dim myDate As Date myDate = CDate("4.10.2008") ' Use your locale date format, like "10/4/2008" strSQL = "INSERT INTO <mytable> (<my date field>) VALUES ('" & … | |
Re: To open Excel: [CODE=VB6]Sub OpenExcel() ' OpenExcel Macro Shell ("D:\Program Files\Microsoft Office\Office10\excel.exe") End Sub[/CODE] To open Excel with a file: [CODE=VB6]Sub OpenExcel() ' OpenExcel Macro Shell ("D:\Program Files\Microsoft Office\Office10\excel.exe ""D:\My Documents\Countries.xls""") End Sub[/CODE] Of course, modify paths to match yours. | |
Re: You can set Icon-property from form's properties when the form is in design mode. If you don't see "Properties"-panel, press F4 to open it. To change project icon go to "Project"-menu and choose "<project name> Properties..." and from "Application"-tab change icon from Icon-drop down. To programmatically change form's icon: [CODE]Me.Icon … | |
Re: At least month has to be in upper case. See [URL="http://www.daniweb.com/forums/thread148265.html"]this thread[/URL] if it helps anything. |
The End.