Skip to content

Visual Basic

Visual Basic Questions

This category can be followed from the open social web via the handle visual-basic@forum.codeproject.com

34.4k Topics 120.1k Posts
  • Question on pure visual basic

    help question database
    2
    0 Votes
    2 Posts
    0 Views
    D
    The reason your text is getting over-written is because LoadFile scraps everything in the control before the new file is loaded. Your going to need 2 RichTextBoxes, one visible, and one not. What you do is tell the hidden RichTextBox to do the LoadFile, then copy and paste the contents of the hidden RichTextBox to the Visible one. Add your blank line to the end of the visible RichTextBox, start over again. Here is a little pseudo-code: ' RichTextBox1 is Visible, RichTextBox2 is not. ' And make sure RichTextBox1 is cleared of text first. RichTextBox1.Visible = True RichTextBox2.Visible = False RichTextBox1.Clear() ' Now, for each filename: ' Have the hidden RTB (RichTextBox2) load the file we want ' then, select all the text in it ' then, tell the visible RTB (RichTextBox1) to Append the SelectedText in the hidden RTB ' and then, append a blank line to the bottom of the text. For Each Filename RichTextBox2.LoadFile(filename) RichTextBox2.SelectAll() RichTextBox1.AppendText(RichTextBox2.SelectedText) RichTextBox1.AppendText(vbCrLf) Next RageInTheMachine9532
  • How can i make or modify a .cpl file Control panel applet

    com help question
    2
    0 Votes
    2 Posts
    0 Views
    D
    You can't modify an existing .CPL file, but you CAN write Control Panel Applications and Control Panel Extensions. Nearly all of the examples I've ever seen are written entirely in VC++, not VB. You can check out a couple of sites first to see if this is what you really want to do: This[^] is a framework for VB that you can hang your own code on to make a control panel app. I've never used it so I can't attest to how easy it is to use. This[^] is the start of the documentation on MSDN for Control Panel Applications. A CPApp is not a stand alone app (.EXE), but an extension to the Shell, this means it's in a .DLL. You'll have to export certain functions like CplApplet. Don't count on any VB examples in here, it's all C++ code. RageInTheMachine9532
  • Uppercase text

    question help sales
    3
    0 Votes
    3 Posts
    0 Views
    M
    Why not just do it the simple way: in the keydown event just do a .toupper for the char and handle the event.
  • Source Code Editor Control

    visual-studio csharp help question
    2
    0 Votes
    2 Posts
    0 Views
    M
    I'm working on this... You can check out the color syntex class I made (For the editor) http://thecodeproject.com/useritems/RTBClass.asp (This is not what the project looks like, this was just a test of the color syntax stuff)... Utill, I am done you can use csharpdevelope it supports VB. http://prdownloads.sourceforge.net/sharpdevelop/098setup.exe?download
  • String.Format Formatting Options

    csharp c++ visual-studio com help
    3
    0 Votes
    3 Posts
    0 Views
    N
    me again Hmm.. here is a much more portable way to implement this code, using a function i made: Module Module1 Sub Main() Dim amtDue(1) As Double amtDue(0) = 1234.56 amtDue(1) = 843.76 Console.WriteLine(PadAmt(amtDue(0))) Console.WriteLine(PadAmt(amtDue(1))) Console.ReadLine() End Sub Function PadAmt(ByVal amt As Double) Dim mystring As String mystring = Format(amt, "n") Return "$" & mystring.PadLeft(8, " ") End Function End Module again, this will display EXACTLY what you wanted, as in my other reply. Please lemme know how it goes, thx. Jordan. III
  • How Handel other Application in VB project

    linux help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Change file size

    tutorial
    6
    0 Votes
    6 Posts
    0 Views
    W
    Hi, I gave the following a try but got nowhere. Could someone assist pls. ================================================================== Imports System.Runtime.InteropServices Private Declare Auto Function CreateFile Lib "kernel32" _ Alias "CreateFileA" ( _ ByVal lpFileName As FileInfo, _ ByVal hTemplate As Long, _ ByVal dwDesiredAccess As Long, _ ByVal dwShareMode As Long, _ ByVal lpSecurityAttributes As Long, _ ByVal dwCreationDisposition As Long _ ) As Long Public Declare Ansi Function DeviceIoControl Lib "kernel32" ( _ ByVal hFile As String, _ ByVal dwIoControlCode As Integer, _ ByVal lpInBuffer As Integer, _ ByVal nInBufferSize As Integer, _ ByVal lpOutBuffer As Integer, _ ByVal nOutBufferSize As Integer, _ ByRef lpBytesReturned As Integer, _ ByVal lpOverlapped As Integer) As Boolean Const CREATE_ALWAYS = 2 Const GENERIC_READ = &H80000000 Const GENERIC_WRITE = &H40000000 Sub command1_Click() dim h h = File.Open("d:\test.txt", FileMode.Create) DeviceIoControl(wes, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, 84, 0) end sub ================================================================== Thanks...
  • can you make an array of properties?

    csharp css visual-studio data-structures help
    2
    0 Votes
    2 Posts
    0 Views
    N
    ok.. i guess i got it working. here it is, if anyone cares: Private tempScore(3) As Integer Property score(ByVal i As Byte) As String Get Return tempScore(i) End Get Set(ByVal Value As String) If Value < 0 Then Console.WriteLine("Score average cannot be less than 0%.") tempScore(i) = 0 ElseIf Value > 100 Then Console.WriteLine("Score average cannot be greater than 100%.") tempScore(i) = 100 Else tempScore(i) = Value End If End Set End Property Jordan. III
  • Datagrid and combobox - Help?!!

    help question csharp css
    4
    0 Votes
    4 Posts
    1 Views
    D
    Well, you'r going to have to make it work that way because you can't tell a combobox which items in its list to display and which to not display. It's all or nothing... RageInTheMachine9532
  • UPPERCASE TEXT

    question help sales
    2
    0 Votes
    2 Posts
    0 Views
    D
    Upper case is : Ucase$(string) Access to Excel: Add a reference to Microsoft Excel Object. Public Class clsXL Dim xl as Excel.Application Private Sub Class_Initialize() On Error Resume Next Set xl = CreateObject("Excel.Application") xl.DisplayAlerts = False End Sub Private Sub Class_Terminate() ' If IsLaunched Then xl.Application.Quit Set xl = Nothing End Sub Public Function Export(rs As Recordset) as Boolean dim ws as Worksheet dim c as integer 'column dim i as integer 'row counter If Not xl Is Nothing Then xl.Workbooks.Add Set ws = xl.ActiveSheet 'Set the column headers '.... 'Now loop through the rows & columns of the recordset to add the values i = 2 do while not rs.eof for c = rs.fields.count w.Cells(i, c) = .Fields(c).Value & vbNullString i = i + 1 rs.movenext next loop 'Format work sheet further 'now print preview the sheet xl.DisplayAlerts = False xl.Visible = True xl.ActiveWorkbook.Worksheets.PrintOut , , , True xl.Visible = False xl.Application.Quit end if End Function By doing this he can do what ever he wants with the excel spreadsheet Save, Sent To or Print. Hope this helps. Michael
  • Scrollable tab

    4
    0 Votes
    4 Posts
    0 Views
    A
    Is it somewhere (sites) I can take a look and see where should I start in order to accomplish my task. Or maybe some examples are exists? Thanks
  • Problem accessing component from VB

    help
    2
    0 Votes
    2 Posts
    0 Views
    A
    It's pretty hard to give you a correct answer without knowing what kind of object JBHRCom is, but assuming that you stick to "talking" naming convention, GetConnection method returns an object of ADODB.Connection type. I would try something like this instead: Dim Con_Getcon As New JBHRCom Dim Con_ObjDB As New ADODB.Connection Set Con_ObjDB = Con_Getcon.Connection
  • How to attach a scroll bar to a picturebox

    tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    A
    In my previous posting I forgot to mention that you control the position of Picture2 relative to Picture1 (which is a Container, remember?) with your scrollbars. The code to do that seems trivial enough: the horizontal scrollbar has to increment/decrement the Picture.Left, while the vertical one controls Picture2.Top properties.
  • Floating point ambiguous errors

    question help tutorial
    4
    0 Votes
    4 Posts
    0 Views
    C
    As a matter of fact, it turns out the Decimal variable type doesn't generate ambiguous errors. Thanks for the input, though. I really appreciate it! :D
  • Default Button in Vb.net

    csharp
    2
    0 Votes
    2 Posts
    0 Views
    J
    I believe what you are asking is which property sets a button to the button that is the default action for a form, such that press "Enter" causes the click event of that button. That property is the AcceptButton property of the Form.
  • default client attachment problem

    help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • MSFlexGrid

    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Internet Explorer Automation

    tutorial testing tools learning
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Embedding icons

    csharp hardware help tutorial question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Help! clock generate

    help question
    8
    0 Votes
    8 Posts
    0 Views
    J
    So what i hv to do is use C or C++, rite? but using C is too troublesome. Can i use a DLL which contain the assemble one, then i call it from VB? I hv read some articles abt MASM. it says that the MASM support a mixed programming language. it means MASM can also be used for Basic or VB? Thank U very much!!! =):-O