[Solved] Error not all code paths return a value?

[ad_1] public Int64 id(string fd, string tb) { Int64 I = 0; if (con.State == ConnectionState.Open) { con.Close(); else { con.Open(); } SqlCommand cmd = new SqlCommand(“SELECT MAX (” + fd + “) FROM ” + tb + “”, con); cmd.CommandType = CommandType.Text; if (con.State == ConnectionState.Closed) { con.Open(); I = Convert.ToInt64((cmd.ExecuteScalar().Equals(DBNull.Value) ? 0 : … Read more

[Solved] How Do I Change Firefox Homepage In VB Code

[ad_1] If you want to change the Firefox’s home page form a program running on the user’s computer, you have to edit the prefs.js file and create a new line like user_pref(“browser.startup.homepage”, “http://www.example.com/”);. Beware that if there are multiple browser.startup.homepage entries every entry will be opened in a new tab when the browser starts up, … Read more

[Solved] Variable is not declared. Permission level error

[ad_1] The error is fairly self-explanatory. txtCustName is used, but not defined, in Form1. You’ll need to define the variable before you can use it, in a syntax like: Dim txtCustName As Textbox Does txtCustName (which I’m assuming is meant to be a Textbox) exist on your form? If not, create it. [ad_2] solved Variable … Read more

[Solved] accept post data in asp and insert into sql server

[ad_1] It’s mostly VB, just switch to it <%@ Page Language=”VB” %> <%@ Import Namespace=”System.Data.SqlClient” %> <script runat=”server”> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim myConn As SqlConnection = New SqlConnection(“Integrated Security=false;Data Source=.;Initial Catalog=DOMAIN_NAME;UserID=abc;Password=123″) myConn.Open() Dim sqlstring As String = ” INSERT INTO sean.local (etype, latitude, longtitude, phone) VALUES … Read more

[Solved] Using variable in for next loop code

[ad_1] To pass a string as a control name, you can use: ParentControl.Controls(“ControlName”). To pass a string as an application setting name, you can use: My.Settings(“SettingName”). Hence, your code should look something like the following: For i = 301 To 305 Step 1 My.Settings(“h” & i.ToString) = Me.Controls(“TextBox” & i.ToString).Text Next Please note that if … Read more

[Solved] VB Getting list of local users

[ad_1] You need to add a reference to System.DirectoryServices to be able to use this function… Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim Users As List(Of String) = GetLocalUsers(“localhost”) For Each User As String In Users MessageBox.Show(User) Next End Sub Private Function GetLocalUsers(ByVal MachineName As String) As List(Of String) Dim WinNt … Read more

[Solved] code to run magnifier vb

[ad_1] You simply just need to open the process from the System32 folder. Here’s how you can open the magnifier: Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Dim MagnifyPath As String = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), “Magnify.exe”) Process.Start(MagnifyPath) End Sub 1 [ad_2] solved code to run magnifier vb

[Solved] PEMDAS Visual Basic [closed]

[ad_1] This should be what you’re looking for. This built-in function has its limits especially if the expression involves trigonometric functions but this should be enough for your needs. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Try Dim answer = New DataTable().Compute(TextBox1.Text, Nothing) MsgBox(answer) Catch ex As Exception MsgBox(“Syntax Error”) End Try … Read more

[Solved] Why is this object reference supposedly not set to an instance of an object that has obviously been identified by the compiler?

[ad_1] The fix ended up being simple, and even logical, in hindsight. The controls are dynamically added to the form, like so: formCustCatMaint.Controls.Add(coName) And so, replacing this line, in the loop: For Each cntrl As Control In Me.Controls …with this: For Each cntrl As Control In formCustCatMaint.Controls And this line, in the GetLabelTextForID() function: For … Read more

[Solved] How to pass Generic List from code behind to javascript

[ad_1] I’ll be utilizing C# rather than Visual Basic, but you could essentially do this: Code Behind: JavaScriptSerializer serializer = new JavaScriptSerializer(); List<Address> deserialize = serializer.Deserialize<List<Address>>(address); foreach(Address address in deserialize) { // Do something with Exposed Properties: } The Address Class will be very, very basic: public class Address { public int Id { get; … Read more