Visual Basic Project

I am currently making a valentine's day card for my programming class and I am suppose to create an algorithm to estimate the cost of the card. What I want the code to do is for every space the user enters in the richtextbox it adds one 5 cents to the total
price.
This is so far the code that I experimented with
the current code is in the richtextbox and I cant seem to figure out how to add 5 cents to each space bar the user inputs. Ignore the 1 its simply a place holder
If e.KeyCode = Keys.Space Then
lblPrice.Text = Val("1")
End If
Also when the user decides to erase words aka the space bar inputs the price goes down. I dont want it to stay the same. Help would be much appreciated!

I suggest handling a different event — TextChanged — in this manner:
Private
Sub RichTextBox1_TextChanged(sender
As
Object, e
As
EventArgs)
Handles RichTextBox1.TextChanged
Dim number_of_spaces = RichTextBox1.Text.Count(Function(c)
Char.IsWhiteSpace(c))
Dim price
As
Decimal = number_of_spaces *
0.05D
lblPrice.Text = price.ToString
End
Sub
However, maybe you should count the number of words or letters instead of spaces?

Similar Messages

  • Using a Visual Basic ActiveX DLL in LabVIEW

    I' like to use some code written in Visual Basic into LabVIEW. I think the best way to do this is making a dll_activeX. I've seen an example on NI site: http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B123AE0CB992111EE034080020E74861&p_node=DZ52048&p_submitted=N&p_rank=&p_answer=&p_source=External.
    When I use the dll present in the "zipped" file it works (I've registered the dll as described in the article).
    If I compile in a DllActiveX the Visual Basic project (Visual Basic 6.0), present in the zipped file, and I try to use, after the unregistrtion of the old one and the registration of new one, it doesen't work.
    I received the following error:
    error 3005Occurred at automation open: Object specified is
    not creatable in a ActiveX Dll with LabVIEW.vi
    Some ideas?
    Thank you.

    Paolo,
    I am not sure why you are getting the error. I downloaded the zip file re-built the dll and then registered it. I originally had LabVIEW open, so I closed and re-opened it so that it would see the new object. I then pointed the ActiveX refnum to the Project1 class. I still had a few broken wires so I hit ctrl-shift-Run Arrow to force a recompile.
    After all that I ran the VI at it worked great. Once that was done I unregistered it and ran the VI. I got an error as expected. I then re-registered the dll and ran it again. No error.

  • Can not select the VISA library (visa32.dl​l) as a reference from Visual Basic.

    I have a copy of Labview base package version 5.1.1 and Microsoft Visual Basic 6.0 in my PII 333 128M PC. I like to use the NI-VISA feature to develope my own testing program by using Visual Basic. However, the NI-VISA library (i.e. visa32.dll) can not be found from the Visual Basic reference library.

    Go PROJECT | REFERENCES menu. In the list, look for "VISA library".
    If the list does not show it, then BROWSE the visa32.dll located in the
    WinNT\SYSTEM32 folder.
    If the VISA library is earlier than V2.x, there is no TypeLib supported.
    Makoto
    "rfan99" wrote in message
    news:506500000008000000B6180000-984882144000@quiq.​com...
    > I have a copy of Labview base package version 5.1.1 and Microsoft
    > Visual Basic 6.0 in my PII 333 128M PC. I like to use the NI-VISA
    > feature to develope my own testing program by using Visual Basic.
    > However, the NI-VISA library (i.e. visa32.dll) can not be found from
    > the Visual Basic reference library.

  • How do i use directX in microsoft visual basic studio 2010 express ?

    i am writing code to graph stock market prices using microsoft visual basic studio express
    i want fast response (i do machine language) using directX
    this is my problem
    i have never used directX, and i have never used directX in visual basic studio
    i followed a tutorial that went like this
      Reference: Microsoft.DirectX
                 Microsoft.DirectX.Direct3D
                 Microsoft.DirectX.Direct3DX
        Imports: Microsoft.DirectX
                 Microsoft.DirectX.Direct3D
                 Microsoft.DirectX.Direct3DX
        Declare: Private D3Ddev As Device = Nothing
                 Private D3Dpp As PresentParameters = Nothing
                 Private DP As DisplayMode = Nothing
    i found the reference dll's at C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0
    when i imported microsoft.directX.direct3DX i got error #1
    namespace or type specified in the imports 'microsoft.directX.direct3DX' doesn't contain any public member or cannot be found...
    the same error occurs wether i use direct3DX \1.0.2911.0 or \1.0.2902.0
    when i built and ran, i got error #2
    microsoft visual basic 2010 express is waiting for an operation to complete ...
    it hangs and i have to soft reset ctrl-alt-del
    error #3
    when i reference
      Microsoft.DirectX
      Microsoft.DirectX.Direct3D and
      Microsoft.DirectX.Direct3DX
      from C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0,
    all my declares work:
            D3Dpp = New PresentParameters()                             'Initialize
    some stuff for the Presentation parameters
            D3Dpp.BackBufferFormat = DP.Format
            D3Dpp.BackBufferWidth = DP.Width
            D3Dpp.BackBufferHeight = DP.Height
            D3Dpp.SwapEffect = SwapEffect.Discard                       'There's flip, copy, and discard. Flip and Discard
    are used most often.
            D3Dpp.PresentationInterval = PresentInterval.Immediate      'Present the scene immediately
    but when i start debugging (f5), i get this error message:
    mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information
    i dont fully understand the visual studio process, but i think 'mixed mode' means run and debug. two seperate app's
    i know this is a long question, but the forums don't answer it properly
    i want it answered concisly. i am running windows 7 basic, and this is my question
    can somebody give me a dozen lines of directX code that will work with my system, so that i can at least draw a line using directX 2D and 3D ?
    thanks everybody :)

    Hi,
    Thank you for your post.
    I am afraid that the issue is out of support range of VS General Question forum which mainly discusses
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    Since your issue is related to DirectX, I suggest you consult on DirectX forum:
    http://xboxforums.create.msdn.com/forums/ for better response.
    Thanks,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How do I open a pdf stored in a Microsoft Access database using Visual Basic studios 2012

    Currently I am unable to find a valid method of being able to open a pdf stored in a Microsoft Access database using Visual Basic studios 2012. I've tried displaying the entire database on a form, but when I do this all the other columns show up with
    the correct data besides the one containing the pdf's, it just displays <binary data> in each row down the column. I also tried another method with which you use the database as a dataset and can drag and drop the rows and columns into the form, which
    again works for all the other columns besides the one containing the pdf's but this time I'm unable to interact with the column  at all. 
    Not too sure if this is in the correct place, but any answers or help would be appreciated. Cheers.

    Alex,
    This forum is dedicated to Project and Project Server. You might get better response, if you post to a Visual Basic forum. Here are couple I could find. 
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral%2Cvblanguage&filter=alltypes&sort=lastpostdesc
    Cheers,
    Prasanna Adavi, Project MVP
    Blog:
      Podcast:
       Twitter:   
    LinkedIn:
      

  • How to edit a WFP application through a Visual Basic command console?

    Hi, I'm currently working on a little project of mine, based mostly on a Visual Basic command console, and I've had the idea to add a console-controlled Windows Form.
    What the console will eventually do is run, say, 1000 x 1000 [(1,1), (1,2), (1,3)... (574, 349), (574, 350)...] items through into a list, and then these million-or-so entries will use their assigned values as the x and y co-ordinates for
    the form, as well as little bits and bobs that will be added as I go along.
    Right now, the thing on my mind is this; How do I make, or access, or run, etc. a form, then load this code into it? I've been heading down some reference path with dependents and other stuff and I don't think it's going to carry me anywhere unless I ask
    the question directly.
    The main plan I have in mind is being to access the controls that a Windows Form has, using the VB console, e.g. Form1.Shape.AddRectangle (x,y) or something.
    If this is even possible, which I'm starting to doubt to my dismay, could you give me an absolute, and I mean that from top to bottom, every aspect fleshed out, preferably on the assumption that I don't even know what a file is, detailed walkthrough?
    Because I don't want to ask questions to the answers to my question.
    Thanks :)

    Items and bits and bobs doesn't have much meaning to me.
    If you want to create a Form from a Console app that is simple. Prior to launching the Form provide whatever you want to it I suppose.
    Whatever you attempt to provide to the form may need references added. Therefore you can research that on your own using the
    MSDN Library search engine which should keep anybody else from having to perform "top to bottom, every aspect fleshed out, preferably on the assumption that I don't even know what a file is, detailed walkthrough" since if you don't know
    anything you should be attempting to learn. And if anything is outside your scope of knowledge that you need to know to do whatever you want to do you should research and learn that. Not ask anybody else to do it for you or provide you baby step instructions
    for doing so.
    It's possible trying to provide 1000000 items and bits and bobs to a form will fail or your app may not have the memory allocated for doing that. And it's probably a poor idea too.
    Option Strict On
    Imports System.Windows.Forms
    Imports System.Drawing
    Module Module1
    Sub Main()
    Dim f2 As New Form
    f2.Left = 10
    f2.Top = 10
    f2.Text = "Test Form"
    f2.Width = 241
    f2.Height = 271
    Dim PB As New PictureBox
    PB.Width = 225
    PB.Height = 225
    PB.Left = 0
    PB.Top = 0
    PB.Image = Image.FromFile("C:\Users\John\Desktop\Picture Files\CrossBones PNG.Png")
    f2.Controls.Add(PB)
    f2.ShowDialog()
    Console.ReadLine()
    End Sub
    End Module
    La vida loca

  • Error trying to open an Excel worksheet...getting Visual Basic MS Forms error

    Hi
    We have just upgraded a user from Office 2007 to 2013. However he is now unable to open an Excel spreadsheet and keeps getting Visual Basic errors
    MS Forms error. “Could not load an object because it is not available on this machine.”
    Acknowledge the error then..
    MS VBA error “Compile error Can’t find project or library”.
    On acknowledging and closing VB window the spreadsheet is available although VB is not running.
    VBA Project (Microsoft Forms 2.0 Object Library). However we still received the same errors.
    So we reinstalled Office 2013 to see if this would update the dll files. Alas the same error. Another user who works with VB said the FM20.dll files should be deleted and replaced with new ones. We acquired another FM20.dll file deleted the older one and
    replaced it in the folder. Rebooted but still the same error.
    He is using a 64bit Windows machine with Office 2013 click2run installed.
    We have spent 6 hours today trying to fix it with no luck.....Please can you help??
    Br
    Dan

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Excel, this issue is more related to the Office develop, please post your question to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Visual Basic express 2010 installation error on windows 7

    Hello all! I'm new here and my problem is that  I cannot install VB Express after upgrading windows 7 from Home premium to Ultimate. VB Express was moved to the windows.old folder along with other programs and refused to open (Application cannot start
    error) so I figured the way to solve it was to re-install which worked for other programs with this issue. It wasn't available in the Add/Remove features either nor would its uninstall program remove the program so i manually deleted the folder.
    I have tried many times to re-install Visual Basic but  to no avail. It always displays Setup could not install the following components: Microsoft .Net which is first on the list and all other the components. Image here: http://www.mediafire.com/view/wzrh64ysojl6wxv/Error_page.png.
    Here is my error log http://www.mediafire.com/view/yc9wb7dqyv561r7/dd_depcheck_VB_EXP_100.txt .I've used programs like CCleaner and VS Uninstall utility to remove traces of VB express for a fresh install but it didn't work either. I've also tried running the
    setup in administrator mode, clearing the temp directory and disabling my antivirus software as recommended in other threads. Please help me fix this problem; I had an ongoing project before this happened. Thanks a ton!!

    Based on that image, it seems that you could not install .net 4.0, I would prefer uninstall .net 4.0 and reinstall .net 4.0 to test, if that still has this issue, then reinstalling that OS will be better choice.
    remember make the reply as answer and vote the reply as helpful if it helps.

  • How to detect if there is a USB Storage in my pc? VISUAL BASIC 6.0

    Hi sir. 
    my program has a function auto back up.  so i want to detect if there is a usb or not. if there's a usb then it will be save in the available usb storage. if there is no usb it wont save and will pop up a msg box saying "There is no USB device,
    please insert USB to continue back up" VB6 platform
    thank you sir.

    Hi NikkoProgrammer,
    Welcome to MSDN.
    I am afraid that as Renee Culver said, these forums donot support VB6, you could refer to this thread:
    Where to post your VB 6 questions
    You could consider posting this issue in these forums below:
    These forums do not support Visual Basic 6, however there are many third-party support sites that do. If you have a VB6-related question please visit these popular forums:
    VB Forums
    VB City
    Thanks for your understanding.
    Best Regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Visual Studio Visual Basic 6.0 Professional - License

    Hi,
    As per the information available online, Visual Basic 6.0 is not supported by Microsoft. 
    Query: This product (Visual Basic 6.0 Professional) was being used with Windows XP and now as part of migration will be moved to Windows 7. Can you please confirm if we need license for this ?
    Thanks !
    Regards,
    Sunny.

    Hello Sunny,
    As you already see, VB 6.0 is not longer supported by Microsoft. And it is also not officially supported to be installed on Win 7.
    If you installed it on Win 7, we cannot provide you any help if you meet any problem. Not to say the licenses. It will be better for you to choose a version of Visual Studio that is supported on Win 7, like Visual Studio 2008, Visual Studio 2010 and
    so on.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Can you tell me how to measure audio signal frequency in measurement studio with visual basic 6.0?

    I'd like to measure two differential input signal(I.e. A+ and A-),below is two test projects,
    1.connect A+/A- to PCI 6052E card's ACH0/ACH8 ,and refer to GND for testing
    2.connect respectively A+/A- to PCI 6052E card's ACH0/ACH8 for testing
    Could you tell me the details of the second project?and give me a illustration in measurement studio with visual basic 6. 0 about the second?
    In addition,I would like to measure the audio signal frequency,could you give me a illustration in measurement studio with visual basic 6.0?
    Wait for your reply!

    Dear kelven,
    Thank you for contacting National Instruments.
    To address your question, there are Analog Input shipping examples that demonstrate how to measure an analog input differentially, as you specify in (2).
    As for measuring the audio signal frequency, you may want to check out the following KnowledgeBase. The link is:
    http://digital.ni.com/public.nsf/websearch/4b08380530d72d3b86256340004c3005
    Let me know if you have any further questions or if this does not resolve your issue.
    Thanks again and have a great day!
    Chad AE
    Applications Engineer - National Instruments

  • Visual basic 6.0

    Hi, I am getting a small application developed in visual basic 6.0, this application is taking screenshots and saving them in as gif images, but the size of the file is too big upto 2-3 mb which takes time to send them thru email in real time. please if
    someone could help me, need code in VB 6,0 to make these files small so that they can be sent in real time thru email.... Or Need a code in VB 6.0 to automate snipping tools. Thanks Sanjiv

    Hi, I am getting a small application developed in visual basic 6.0, this application is taking screenshots and saving them in as gif images, but the size of the file is too big upto 2-3 mb which takes time to send them thru email in real time. please
    if someone could help me, need code in VB 6,0 to make these files small so that they can be sent in real time thru email.... Or Need a code in VB 6.0 to automate snipping tools. Thanks Sanjiv
    VB6 programmers are gods of programming! You may be interested in the following Visual Basic 6.0 open source projects (surely you will solve the problem with these projects):
    http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=74904&lngWId=1
    http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=71666&lngWId=1
    http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=44137&lngWId=1
    There are thousands of VB6 advanced codes for image compression (many of them contain new algorithms for compression), choose one :)

  • Using Crystal Reports in Visual Basic 2010

    I am trying to add several Crystal Reports to a new project and having a major problem.  Here's the situation. I created a new Visual Basic 2010 project with only one form, In visual Basic I added Crystal Reports.   I then imported a form that was created in Crystal Reports 8.5.
    There were no errors and the report with valid data was visible. I then tried to run...it wouldn't run and 31 errors appeared.
    Obviously I missed something. I have searched for a very simple basic tutorial and  either can't find one or didn't recognize one.
    Can anyone point me in the right direction.
    Milt

    Ok. So, you added the report to the project. Now we have to add the CR assemblies to the project, add the viewer (if need be) and fire it off. Simplest code would be:
    Public Sub New()
            ' This call is required by the designer.
            InitializeComponent()
            ' Add any initialization after the InitializeComponent() call.
            CrystalReportViewer1.ReportSource = ("path to report")
        End Sub
    In this case you are using the viewer SDK to runt he report. The report will prompt for any logon parameters - but you can code these also. You can load the report via the engine as bellow. Again, the report will prompt. I prefer to use the engine as it is way more "extensible"...
    Public Sub New()
            ' This call is required by the designer.
            InitializeComponent()
            ' Add any initialization after the InitializeComponent() call.
            Dim crReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
            crReportDocument.Load("path to report")
            'Bind the report to the viewer
            CrystalReportViewer1.ReportSource = crReportDocument
        End Sub
    If you have a report added to the project (strongly typed) the code would be:
    CrystalReportViewer1.ReportSource = New myReport()
    For more details, I'd recommend looking at the sample app vbnet_win_simplepreviewreport.zip available from the following location:
    https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
    The developer help files are here:
    [SAP Crystal Reports .NET SDK Developer Guide|http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_dg_2010_en.zip]
    [SAP Crystal Reports .NET API Guide|http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_api_2010_en.zip]
    - Ludek

  • Daqmx installation to be used in visual basic 2008

    I plan to use PCI-6509 Digital IO in visual basic 2008. I installed NIDAQmx9.5.1.f2.
    After installation, NIMax can detect the hardware(PCI-6509) successfully. NIMax was installed when DAQMX was installing.
    But In VB2008>project>add reference>.NET, I can not see NationalInstruments.daqmx.
    So I can't add it to my vb2008 program's reference.My program use PCI-6509 to control relay.
    my PC has window 7 64bit operating system and the following .NET has been installed already.
    Microsoft.NET compact Framework 2.0 SP2
    Microsoft.NET compact Framework 3.5
    Please let me know if you have any idea?
    Thank you in advance.

    Finally I solved the problem after reading the following document.
    http://digital.ni.com/public.nsf/allkb/0EA34D565632DFE186256E7B00762DCC
    The summary is
    1. I need custom installation.
    2. select NET Framework 3.5 language support. => install this feature to a local drive(do not select subfeatures)
    3. And do not select Measurement Studio Integration under NET Framewrork 3.5 language support.
    Now I can add DAQmx reference in my program without any problem.
    Thank you for everybody who replyed.

  • How would I save settings in Visual Basic 6?

    Hello, I'm working on a project with a countdown timer and I'd like to save the value so that when the program next starts up, it will continue where the timer last was. For instance the timer is at 05:43:21 and I close the application. When it next opens,
    it will resume at that countdown. 
    This is for Visual Basic 6, I know that this is for .NET framework only however I could not find a section for VB6 questions. Moderators, please move this if there is a section. I know Microsoft no longer supports VB6 but I could not think of where else
    to ask.

    Sticky post at the top of the VB forums titled
    Where to post your VB6 Questions
    moving to off-topic
    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

Maybe you are looking for

  • Exporting a query report in Excel gives a wrong value.

    Hi All, After running the query report, from the menu path, I do List > Export > Spreadsheet.  At that point, you can save the file and Excel opens up.  The value for the amount are displaying with additional zeroes For example 14,000.00  is dispalye

  • After update, Garageband 10 is deadly slow in Mavericks 10.9.3

    After updating to Mavericks 10.9.3 and to Garageband 10.0.2, Garageband is very slow, permanently triggering the beach ball - especially when editing piano rolls. Looking at the Activity Monitor at such moments, I see that the WindowServer process ta

  • Motion Tracking always 'wonders off'

    I don't use after affects much as i do mostly website stuff. Sorry if this question may be simple/dumb, but i cant for the life of me figure it out ... I have a video that I do tracking on.... simple x/y tracking... My workflow is: I usually like to

  • Recommended Number LUNs for ASM Diskgroup

    We are installation Oracle Clusterware 11g, Oracle ASM 11g and Oracle Database 11g R1 (11.1.0.6) Enterprise Edition with RAC option. We have EMC Clariion CX-3 SAN for shared storage (All oracle software will reside on locally). We are trying to deter

  • Good books for BI data warehousing ?

    hi there, i visited BW310 and BW305 course at SAP. i am new in SAP BI (i am coming from SAP R/3, with experience of over 7 years) To get my knowledge refresehed i am looking for GOOD(!!), 'easy to understand' literature of SAP BI data warehousing. Be