I'm working on a project in which I've to fetch the device name of the user. For example, currently I'm using the desktop, so the device name is like DT******89789 which tells that the user is of desktop user. like wise I want to know the device name of the tablet and other devices also. This is the code which I've written in VB.Net to fetch the device name.
Partial Class VB
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Write("Client Computer Name : " & System.Net.Dns.GetHostByAddress(System.Web.HttpContext.Current.Request.Item("REMOTE_HOST")).HostName.ToString())
End Sub
End Class
The problem is when I run the above code, it's working fine in the local host(using visual studio 2015) as well as on the server(after uploading code on the server), It's fetching correct data but when I open the same website in the windows tablet over the VPN either the page throws error or doesn't show anything. It shows this error:-
**\Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /esp/vb.aspx
Version Information: Microsoft .NET Framework Version:4.5**
I want the device name of the user like tablet in this case over the VPN. Thanks
Related
This is for a quiz game that I am doing for a class assignment and I am a beginner in using both Visual Studio and the language vb.net.
I am trying to get this sound to play when the form comes up, that's all. The file itself plays fine when I click on it.
Error: 'crowdbooing' is not a member of 'VS_BeatTheBrain_JKEM.My.Resources'.
My Code:
Public Class frm_loser
Friend WithEvents player As New System.Media.SoundPlayer
Private Sub frm_loser_Load(sender As Object, e As EventArgs) Handles MyBase.Load
player.Stream = My.Resources.crowdbooing
player.Play()
End Sub
End Class
I have checked and the audio file (.wav) is definitely in the resource folder, I have already tried:
Removing it and re-adding it
Re-downloaded it
Tried another computer
Teacher tried it on theirs and it worked (the code, I believe they used a different audio file but from the same source that I got mine from)
Renamed it
Searched the internet for a solution
Tried changing 'Build Action' property on audio file to either 'None' or 'Embedded Resource' or 'Resource'. (Didn't Work)
Proof Audio File is in Resources, As Shown
Proof 2
What it shows when I hover over the code
Update: Problem has not been solved on the original project. Created a new project, copy & pasted forms from original into the new one and the sound now works.
so i'm trying to make a media player so far i'm in the final stage to publish my media player for poeple to download it i'm just having an issue where i need to capture command line argument on runtime , so far i've checked the run only one instance of the app and i can recieve command line argument when using Open With from windows explorer it works but what i need to do is to be able to recive command line arguments on runtime , assume you're using my app , you're listening to music and you found a music you love on a folder on your pc , you're so lazy to switch to the app and use the open file button you just want to double click the song and start listening , now if the app is closed when you double click the song it will play with no problem but if the app is running it won't play windows will just switch to the app.
So the question is : is there an event or a way to catch if command line argument is passed to the app on runtime ?
Since you have indicated that you made the application a single instance application, it is very likely that you are using VB's Application framework. This framework exposes the StartupNextInstance Event. From the documentation for that event.
You must use the CommandLine property of the e parameter to access the arguments for subsequent attempts to start a single-instance application.
To add a handler for that event, you can use the designer to create the handler via Project Menu->PropjectName Properties->Application Tab-View Application Events Button or just copy the following to a code file in your project.
Imports Microsoft.VisualBasic.ApplicationServices
Namespace My
Partial Friend Class MyApplication
Private Sub MyApplication_StartupNextInstance(sender As Object, e As StartupNextInstanceEventArgs) Handles Me.StartupNextInstance
' use e.CommandLine
End Sub
End Class
End Namespace
I made a small application that getting data from a .accdb file and make some reports using .rdlc report.
The problem is that i need to give this application to an end users woking in different workstations which means the connection string will be different than the one which i used in the application , i’ve tried to make it dynamic by letting the use select were the db file , but it will not be successful for the table adapters which been created for reporting.
Any idea how this can be solved?
Thanks all.
I am assuming you are using ado.net typed table adapters.
Usually, the typed table adapter uses the connection string defined in the setting file (app.config file). You can override the setting value programmatically when the application loads the setting file for the first time.
In the visual studio, open the project properties page (right-click the project and select Properties),
Select the Settings tab page.
On the Settings tab page, find and click '<> view code' button (it is located on the top of the tab page).
Override the files as you needed:
Imports System.Configuration
Namespace My
Partial Friend NotInheritable Class MySettings
Private Sub MySettings_SettingsLoaded(sender As Object, e As SettingsLoadedEventArgs) Handles Me.SettingsLoaded
Item("<your connection string name here>") = "<your connection string here>"
End Sub
End Class
End Namespace
Here is the screenshot of it
Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'CustomerRecordsDataSet.CustomerRecords' table. You can move, or remove it, as needed.
Me.CustomerRecordsTableAdapter.Fill(Me.CustomerRecordsDataSet.CustomerRecords)
End Sub
First of all I'm just a newbie with VB. I tried searching for tuts and tried to use the datagrid. I created my MS Access document for the database and created the form so I linked the datagrid form to my main window but whenever I click the button for the datagrid form it shows InvalidOperationException was unhandled and it highlights this Me.CustomerRecordsTableAdapter.Fill(Me.CustomerRecordsDataSet.CustomerRecords).
Need an ASAP explanation thanks in-advance
The error is telling you what the problem is. The data provider isn't there (Microsoft.JET.OLEDB.4.0). This can happen if you don't have it installed, or you are running an "Any CPU" or "x64" application on a x64 system. Have you tried the ACE provider (Microsoft.ACE.OLEDB.12.0)?
Details: https://www.connectionstrings.com/access/
There are also many articles on that site that address various problems. For example: Jet for Access, Excel and Txt on 64 bit systems
The Microsoft OLE DB Provider for Jet and the Jet ODBC driver are available in 32-bit versions only. You can't run them in 64 bit mode.
I am programming in Windows Mobile SDK 6 using Visual Basic, i would like to know how to make a button open the smartphone browser with a specific website path (make a link)
I got to the next piece of code so far:
Public Class GuitarHelperPage
Public link As New WebBrowser
Public adress As Uri
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
adress = New Uri("https://www.google.com")
Try
link.Navigate(adress)
'link.Focus()
Catch ex As System.UriFormatException
Return
End Try
End Sub
(the commented 'link.Focus()' its just something i tryed out, but i got the same output)
I simply want to click the button and open the browser at google homepage. But when I click it, the warning "This page contains both secure and nonsecure items. Do you want to continue?" appears and when I click "yes", nothing else hapens.
I've been researching and found this on MSDN help pages:
"The WebBrowser class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your Main method is marked with the STAThreadAttribute attribute"
SO i added this my main method:
<STAThread()> _
Shared Sub Main()
But still i get this error : "Type STAThread is not defined." And can't find a away around, I tried to add this same attribute to a Windows Desktop VB project and it works, maybe there is another way to do it in Mobile?
I am using .Net Framework 3.5 and windows mobile sdk 6.0 for this project
Please help, thank you.
If you want to open the default browser, you don't need a WebBrowser control. Just use the Process class, specifically the Start overload that takes in a ProcessStartInfo. Set the UseShellExecute property of the ProcessStartInfo to true so that it will open the default browser (e.g. if the user installed Opera Mobile, it will use that, not just always force IE).