Visual Basic.NET

93K

Solutions

24K

Contributors

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to  Visual Basic pre-2002, it is not the same technology,

Share tech news, updates, or what's on your mind.

Sign up to Post

Im creating a form. Trying to test buttons on it with the code ive written.

I run debug, form loads for 2 seconds, then it goes back to design mode.

How can I keep it from reverting to design mode, I need to test my buttons.
0
Get your problem seen by more experts
LVL 12
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

TxtStartDate.Value = CDate("1/" & Today.Month & "/" & Today.Year)
        TxtEndDate.Value = CDate(Date.DaysInMonth(Today.Year, Today.Month) & "/" & Today.Month & "/" & Today.Year)
        loaddata()
this is the error
Conversion from string "31/7/2018" to type 'Date' is not valid.
0
Hello,
How to read excel from vb.net app
I am using visual studio 2017 windows .
Any suggestions?
Cheers
0
I use this code to connect to a remote server:
<%@ Import Namespace="System.Net" %>
<%

Dim myReq As HttpWebRequest
Dim myResp As HttpWebResponse

myReq = HttpWebRequest.Create("https://google.com/")

myReq.Method = "PUT"
myReq.ContentType = "application/json"
myReq.Headers.add("Authorization", "Bearer e464f18c4e88c690a9ad9d23d051a3b85dae7f81d4edc6d0c590372d286bb5b9")
Dim myData As String = "{""fields"":{""slug"":""onez"",""words"":""hello worldz"",""name"":""Nnnnamez"",""_archived"":false,""_draft"":false, ""zimage"": ""<div>Hello</div>""}}"
myReq.GetRequestStream.Write(System.Text.Encoding.UTF8.GetBytes(myData), 0, System.Text.Encoding.UTF8.GetBytes(myData).Count)
myResp = myReq.GetResponse
Dim myreader As New System.IO.StreamReader(myResp.GetResponseStream)
Dim myText As String
myText = myreader.ReadToEnd

Response.write(myText)

%>

Open in new window

The remote server returns a 405 error code and it also returns content.  How can I get by ASP.NET VB code to grab and return the content that was sent along with the 405 error header?  I want to see the details that the remote error is sending.
0
I have a VB.Net program that uses CrystalReports to print an ID card (CR80).
The viewer shows a portion of a full-size letter format, with horizontal & vertical scroll bars.
What programming / controls are needed to:
1. Resize margins to CR80 ~ 2.13" x 3.38".
2. if necessary, remove scroll bars.

Thank you,

Russ
0
SqlStr = "select  ROW_NUMBER() OVER (ORDER BY id) AS [Sno],Employees.EmpID,Employees.contactno,Empname as [Employee Name],WorkType,ClientName,SiteName,Siteschedule.TotalHours AS [Total Working Hours] from Siteschedule inner join clients on clients.clientid=Siteschedule.clientid inner join sites on sites.SiteID=Siteschedule.SiteID  inner join Employees on Employees.EmpID=Siteschedule.empid  where (StartDateValue between " & TxtStartDate.Value.Date.ToOADate & "  and  " & TxtEndDate.Value.Date.ToOADate & ") " & substring
 ambigous column name id
0
When I compile someone c# code, I got the following warning.  What do I need to resolve this? Any idea?

The primary reference "xxxConfiguration" could not be resolved because it has an indirect dependency on the assembly "xxxAsync, Version=7.05.101.0, Culture=neutral, PublicKeyToken=58aa7495915e0000" which was built against the ".NETFramework,Version=v4.6" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5".
0
I want to have a punch in / out functionality by using just a barcode reader to scan the employee barcode then deal with it in the database.

We have only one screen (And the customer does not want to have multi-screens), however), The customer wants to let each employee punch in by scanning his card while the main user is using the application. How can I do that (As if I have 2 separate computers one for punch in/out and the other is for the normal cashier and system work?):

1. Is there any global application event which is triggered by keyboard regardless of the active form, and in focus control?
2. Is there any trigger that allows the barcode scanning to start a quick application to perform the functionality and close itself?
3. Is there a possibility to have the main application open, and a punchInOUT application also running (only one screen with one text box), but make the barcode scanning affecting only the punchINOUT application?
4. Any brilliant idea to allow this functionality

Thanks in Advance for help. Please help in VB.NET (I am using VS2010)
0
Hi,
I've got two application in vb.net: One with a form for authentication (App A) and one wich require authentication (App B) to access it
Everything works fine, but it happens this when the session is outdated (ex. i leave App B opened on a page) :

-> i trigger whatever control on the opened App B
->This cause a page load that, checking for login with My.User.IsAuthenticated, redirect me to App A
-> App A ask me to login, and from the logged in menu i select to access App B
-> On PageLoad, App B chek again for My.User.IsAuthenticated which return false, even if i logged on App A

So i cannot access App B anymore if i don't clear the cache
This happens when the session is outdated, but not if i login/logoff manually

Is there some settings App User that i should check?
0
Playing AVI files in a picture box from dll. .OCX and other files in Visual Basic 10 Express.
I would like to have a complete code that reproduces. avi files in the. dll. OCX and other files in a PictureBox written in Visual Basic 2010 Express.
So to speak for example that it reproduces an AVI file while it is copying a file (I have the code in Visual Basic 6 and I cannot get it to work in Visual Basic 2010 Express).
From what I could understand by reading the various forums in Internet there is also the possibility of embedding an AVI file by transforming it into a resource and uploading it to Visual Basic 10 Express, if it were so it would be good to know how to create that resource, embed it in Visual Basic 10 Express and play it in a picture box while the application is working (always with full code).
is clear transparency effect and continuous play.
I would want complete code to download with any clarifications.
Without wasting time writing code I'm attaching a file containing a working Visual Basic 6 program that I've tried to convert to Visual Basic 10 express in all ways, you might see if it did you and send it back to Visual Basic 10 Express.
Thank you.
0
Cloud Class® Course: Ruby Fundamentals
LVL 12
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

I have an access database that I am converting to a vb.net project.  There are a few lines of script that are causing issues.  Mostly the DLookup conversion.  Any help at converting this script would be most appreciated.  Thank you in advance!

Here is the original VBA code:

Private Sub Form_Timer()
'On Error GoTo ErrTrap:
    Dim DB As Database
    Dim rs As Recordset
    Dim count As Integer
    Dim displayCount As Integer
    Dim formToOpen As String
    Dim stopTime As Date
    Dim nowTime As Date
    Dim WinWnd As Long
   
    'Determine if a member of management has set an alert message. If not, continue normal operations
    If DLookup("Alert", "AlertMessage", "Alert > 0") <> "" Then
       
        'Open the alert message
        DoCmd.OpenForm ("frmMessage")
       
    Else
   
        Call Form_Query
       
        ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
       
        'Run the NRFT screen for 1 minute, then open the safety message
        If runCount = 2 Then
            DoCmd.OpenForm ("Form1")
        End If
       
        'Close the safety message after 1 minute
        If runCount = 5 Then
            DoCmd.Close acForm, "Form1"
        End If
       

           
        If runCount >= 8 Then
       
       
            'Loop through all rows in the Content table where Active is set to yes
            'For Count = 0 To DCount("Active", "Content", …
0
Code below is supposed to go through a list of word docs, all docs being printed are blank.

Any idea what I could be missing? For now I'm only printing 1 page docs. Would anyone be able to incorporate StreamReader code into there for me? I'm reading a print guide at the moment, would love ideas.

 Imports system
Imports system.Windows
Imports System.Object
Imports System.Windows.Forms


Module Module1


    Sub Main()
         
         Dim files() as String = IO.Directory.GetFiles("C:\Users\Hares1\Desktop\PROGRAMS\DWG")
    
    For Each file In files
       Dim psi As New ProcessStartInfo(file)    
      Try

             
        psi.Verb = "printto"       
        psi.UseShellExecute = True
        psi.WindowStyle = ProcessWindowStyle.Hidden
        psi.CreateNoWindow = True 
        Process.Start(psi).WaitForExit(5000)          
      Catch ex As Exception
        Console.WriteLine(File)               
      End Try	  
	Next file	

	
	
	Console.WriteLine("Done.")
	Console.ReadKey()
    End Sub

End Module

Open in new window

0
Code below only prints 1 doc, the first one

I have a few files in my path, but it wont print the rest...
Any ideas?

Imports System
Imports System.IO
 Imports System.Windows.Forms
 Imports System.Windows.Forms.Form
Imports System.Windows.Forms.PrintPreviewDialog




Module Module1


    Sub Main()
        Dim PrintDialog1 As New PrintDialog()
          Dim files() as String = IO.Directory.GetFiles("\\sv-fs03\users$\..........\dwg printer")
    For Each file In files
               
      Try

                 Dim psi As New ProcessStartInfo(file)
        psi.Verb = "print"       
        psi.UseShellExecute = True
        psi.WindowStyle = ProcessWindowStyle.Hidden
        psi.CreateNoWindow = True 
        Process.Start(psi).WaitForExit(5000)          
      Catch ex As Exception
        Console.WriteLine(File)               
      End Try   
Next file
        Console.WriteLine("Done.")
Console.ReadKey

        
     

    End Sub

End Module

Open in new window

0
I have the following code which is working perfectly:

Public Sub MakeThisConfidential()
Application.ActiveInspector.CurrentItem.Sensitivity = olConfidential
Application.ActiveInspector.CurrentItem.Save
' MyMsg = MsgBox(Prompt, 0, "This message has been marked Confidential and will be encrypted by Fusemail")
MyMsg = MsgBox("Click OK to accept status" & vbCrLf & "This will encrypt the Current Message using fusemail", 0, "This message has been marked Confidential")
End Sub

Sub ToggleSensitivity()
    If ActiveInspector.CurrentItem.Sensitivity = olConfidential Then
        ActiveInspector.CurrentItem.Sensitivity = olNormal
        MyMsg = MsgBox("Click OK to accept status" & vbCrLf & "This will NOT encrypt the Current Message using fusemail", 0, "This message has been marked Normal")
    Else
        ActiveInspector.CurrentItem.Sensitivity = olConfidential
        MyMsg = MsgBox("Click OK to accept status" & vbCrLf & "This will encrypt the Current Message using fusemail", 0, "This message has been marked as Confidential")
    End If
End Sub

Open in new window


I have attached it to 2 separate buttons
I want to be able to run the macros and change the current button image. The image is added by the outlook interface:
In the New Mail window:
File - Options - Customise Ribbon - Main Tabs - New Mail Message
There is a group in here which has buttons with the macro's attached
0
I need one Print Dialog() box for my entire batch of documents in a given folder. Currently I'm looping through each file in a folder (I'd like to maintain this, because i'll be programatically modifying files), however I want to be able to change the print settings once and use it for all files ~ the code below works for looping and printing, however I'm not sure where to include PrintDialog()   ~ I'm thinking something along the lines of passing the entire subroutine to printdialogue as a parameter.  For now I'd like to avoid Click events, any thoughts, ideas?

Any ideas?

 Imports system
Imports system.Windows
Imports System.Object
Imports System.Windows.Forms


Module Module1


    Sub Main()
         
         Dim files() as String = IO.Directory.GetFiles("C:\Users\Hares1\Desktop\PROGRAMS\DWG")
    
    For Each file In files
               
      Try

                 Dim psi As New ProcessStartInfo(file)
        psi.Verb = "print"       
        psi.UseShellExecute = True
        psi.WindowStyle = ProcessWindowStyle.Hidden
        psi.CreateNoWindow = True 
        Process.Start(psi).WaitForExit(5000)          
      Catch ex As Exception
        Console.WriteLine(File)               
      End Try   
Next file

 
 
Console.WriteLine("Done.")
Console.ReadKey()
    End Sub

End Module

Open in new window



Worst case scenario could I include the aboive code in its own class, and pass it as a parameter to PrintDialog()   ??
0
Hello,

Im relative new on Programming using VB.NET but, I want to know how can I use a webservice on Windows Forms app, I have a REST API.

Any idea of how can I do this requirement?.

Regards,
0
Is there a way to recover the password on a Word VBA Project using programming code? My file format is .dot. A Lot of recovery tools available in online but need to pay for those products I'm a student not able to pay so I need to recover or view my VBA project .dot file forgot password using code. Is it possible in code using .net programming or VBA code or any other programming codes?
0
Ok, so the below code goes through the files in a folder and prints them ~

What I want to do is for the code to read the docs 1 by 1, since there are problem docs, and thats why i'm creating this~

I'm going to wait for a sleep timer on the docs that wont print ~

hence why I want the process to run once for each doc

How would i run the PSI process once for each doc (in this case filepath), then loop back to the beginning of the process...?
Module Module1


            Sub Main()
  
         For Each filePath In IO.Directory.GetFiles("......\Desktop\PROGRAMS\DWG")
    Try
        Dim psi As New ProcessStartInfo(filePath)
 
        If 1=1

                

            psi.Verb = "print"

                  

        
            psi.UseShellExecute = True
            psi.WindowStyle = ProcessWindowStyle.Hidden
            psi.CreateNoWindow = True
 
            Process.Start(psi).WaitForExit(5000)

          
        Else
            Console.WriteLine("No 'print' verb associated with file extension " & IO.Path.GetExtension(filePath))
        End If
    Catch ex As Exception
        Console.WriteLine(ex.ToString(filepath))
               
    End Try
             Console.ReadKey()
Next
       End Sub


End Module



  
      

Open in new window

0
I have an MDI Form and a Login Form in VB.NET. When the user enters the data correctly, I present the mdi form that is the main one. When the user closes the MDI Form I want to present the Login Form again. So I want to know what to do to be able to present the same instance of the Login Form. I have tried several methods and none of them work for me.

Login_Form calls MDI_Form, when closing MDI_Form, present Login_Form again.

Please give me examples and what would be the best solution.

Regards...
0
Introducing Cloud Class® training courses
LVL 12
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

I have 2 Windows Applications which already contains a CrystalReports1.rpt, CrystalReport11 and CrystalReportViewer1 in Form1 design.
Questions:
1. How do I merge the 2 into 1 Windows Application AND
2. What changes do I need to make (where), so there isn't any confusion between the 2 reports?

Both reports will be accessed via a separate  button for each.

Thank you,

Russ
0
Hello..

How to send text message in vb.net by sms.>
0
I need the Print dialog box to show up through a console APP I'm creating ~

I've seen articles mentioning how to do this on a form using:  
If PrintDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
    ' print the document
End If

However this will be a console APP where the user clicks the exe, I want the printer dialogue box to open up, once the user chooses print settings I want all the docs in the folder to be printed. basically I'll be placing the dialogue box code at the top level.

Any ideas on how to do this?
0
Hi experts
I have a vb6 project using arrays to manipulate records and calculations the performance are very low.
We want to convert to vb.net and find a better alternative for the arrays.

Any suggestions ?

Thanks in advance-hagit
0
How can I print all the files in a folder (the same extension) to another folder in the system.

I have various methods I want to invoke on the documents, so I need a print method, not a copy...

Any clues at all?
0
VB.NET PRINT files in one folder to the next -

Basically I want to print all the files in one folder, to another folder on the system.

Could someone give me one or 2 lines of code for doing this?

When I do   psi.Verb = "print"  this is printing out on physical paper.   I want to actually print it to the system. This is driving me nuts.
0

Visual Basic.NET

93K

Solutions

24K

Contributors

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to  Visual Basic pre-2002, it is not the same technology,