Search Results

Search found 4472 results on 179 pages for 'vb'.

Page 32/179 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Change a registry value in vb.net

    - by mhofer
    Hello, I have searched a lot to find a solution for my problem, but I can't find any specific solution. I need to change a value which is stored under HKEY_LOCAL_MACHINE\SOFTWARE\APP_NAME. It is not possible to use .NET's registry functions, since they have drastic restrictions. The following snippet should solve my problem: Dim regKey As RegistryKey Dim ver As Decimal regKey = My.Computer.Registry.LocalMachine.OpenSubKey("HKEY_LOCAL_MACHINE\SOFTWARE\APP_NAME", True) regKey.SetValue("IP", "192.168.10.15:18500") regKey.Close() Unfortunately, I get a NullReferenceExeption when I try to set the value. What should I do? I have imported Microsoft.Win32 and RegistryKey doesn't accept any constructor... cheers mike

    Read the article

  • VB.net SyncLock Object

    - by Budius
    I always seen on SyncLock examples people using Private Lock1 As New Object ' declaration SyncLock Lock1 ' usage but why? In my specific case I'm locking a Queue to avoid problems on mult-threading Enqueueing and Dequeueing my data. Can I lock the Queue object itself, like this? Private cmdQueue As New Queue(Of QueueItem) ' declaration SyncLock cmdQueue ' usage Any help appreciated. Thanks.

    Read the article

  • VB.NET encoding one character wrong

    - by Nick Spiers
    I have a byte array that I'm encoding to a string: Private Function GetKey() As String Dim ba() As Byte = {&H47, &H43, &H44, &H53, &H79, &H73, &H74, &H65, &H6D, &H73, &H89, &HA, &H1, &H32, &H31, &H36} Dim strReturn As String = Encoding.ASCII.GetString(ba) Return strReturn End Function Then I write that to a file via IO.File.AppendAllText. If I open that file in 010 Editor (to view the binary data) it displays as this: 47 43 44 53 79 73 74 65 6D 73 3F 0A 01 32 31 36 The original byte array contained 89 at position 11, and the encoded string contains 3F. If I change my encoding to Encoding.Default.GetString, it gives me: 47 43 44 53 79 73 74 65 6D 73 E2 80 B0 0A 01 32 31 36 Any help would be much appreciated!

    Read the article

  • vb .net login and popup simultaneously

    - by unire
    ok im reposting this question cause i got some off track answers last time. I have 3 aspx pages - page1, login and page3. Now when i goto login page from page1, after i login and goto page3 i should be able to open a popup on that submit and the login should change to page3. but if i goto login page directly, the popup should not open and the login will goto page3 as normal design. how can i achieve this?

    Read the article

  • VB.Net HTTPWebRequest Speed is slow comparing Python URLOpen

    - by regexhacks
    Hi I am coding a web-crawler which will crawl the websites and selectively parse different sections of a web site. I am a .Net developer so the choice was obvious that I did it in .Net but the speed was very slow which included downloading and parsing of HTMLPages Then I tried to just download the contents first using .Net and then same domains using python but the python was very impressive in downloading data. I have achieved downloading using python but the later part is not that easy to code in python, which obviously i don't want to do. The same batch of domain which took 100 seconds in Python was taking 20 minutes in .Net based crawler I tried http://www.eqlit.com/ to download and in took 8 seconds in Python and same was taking 100 Seconds in .Net crawler Does anyone anyone have any idea why this is slow in .Net but fast in python?

    Read the article

  • VB.NET Button Issue

    - by Michael
    I am having problem with a button the code of my button is. Private Sub btnCalculateCosts_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateCosts.Click it handles: ' This Calculate Costs button click event handler edits the ' registration(costs) form to ensure it contains valid data. ' Then, after passing control to the business class, it ' displays the registration cost. Dim objCourse As Course Dim objCourseCostsFile As Course Dim InputError As Boolean = False ' Is student ID entered properly If Me.txtCorporateID.MaskFull = False Then MessageBox.Show("Enter your Corporate ID in the Corporate ID box", _ "Error") Me.txtCorporateID.Clear() Me.txtCorporateID.Focus() InputError = True ' Is student name entered properly ElseIf Me.txtFirstName.TextLength < 1 Or _ Me.txtFirstName.Text < "A" Then MessageBox.Show("Please enter your first name in the First Name box", "Error") Me.txtFirstName.Clear() Me.txtFirstName.Focus() InputError = True ' Is number of units entered properly ElseIf Me.txtLastName.TextLength < 1 Or _ Me.txtLastName.Text < "A" Then MessageBox.Show("Please enter your last name in the Last Name box", "Error") Me.txtLastName.Clear() Me.txtLastName.Focus() InputError = True ' Is number of units entered properly ElseIf Not IsNumeric(Me.txtNumberOfDays.Text) Then MessageBox.Show("Enter the units in the Number of Units box", _ "Error") Me.txtNumberOfDays.Clear() Me.txtNumberOfDays.Focus() InputError = True ' Has 1-4 units been entered ElseIf Convert.ToInt32(Me.txtNumberOfDays.Text) < 1 _ Or Convert.ToInt32(Me.txtNumberOfDays.Text) > 4 Then MessageBox.Show("Units must be 1 - 4", "Error") Me.txtNumberOfDays.Clear() Me.txtNumberOfDays.Focus() InputError = True End If ' If no input error, process the registration costs If Not InputError Then If Me.radPreConferenceCourse.Checked = False Then objCourse = New Course(txtCorporateID.Text, txtFirstName.Text, txtLastName.Text, txtNumberOfDays.Text) Me.lblCosts.Visible = True Me.lblCosts.Text = "Total Conference Costs Are: " _ & (objCourse.ComputeCosts()).ToString("C2") Else objCourse = New Course(txtCorporateID.Text, txtFirstName.Text, txtLastName.Text, txtNumberOfDays.Text, g) Me.lblCosts.Visible = True Me.lblCosts.Text = "Total Conference Costs Are: " _ & (objCourse.ComputeCosts()).ToString("C2") Receiving the error: Handles clause requrieres a WithEvents variable defined in the containing type or one of its base types.

    Read the article

  • Calling a Sub or Function contained in a module using "CallByName" in VB/VBA

    - by Kratz
    It is easy to call a function inside a classModule using CallByName How about functions inside standard module? 'inside class module 'classModule name: clsExample Function classFunc1() MsgBox "I'm class module 1" End Function ' 'inside standard module 'Module name: module1 Function Func1() MsgBox "I'm standard module 1" End Function ' ' The main sub Sub Main() ' to call function inside class module dim clsObj as New clsExample Call CallByName(clsObj,"ClassFunc1") ' here's the question... how to call a function inside a standard module ' how to declare the object "stdObj" in reference to module1? Call CallByName(stdObj,"Func1") ' is this correct? End Sub

    Read the article

  • Change path to save mysettings - VB.NET 2008

    - by yae
    Hi: I am using mysettings to save user settings. This config file is saved in this path: c:\ Documents and Settings \ \ [Local Settings] Application Data\\\ Is possible to change this path? For example, in my case I save app data in "ProgramData" folder (Vista & W7) and I would like save this config file in the same folder. Is possible? Thanks in advance

    Read the article

  • update value of a variable outside a class in VB.NET

    - by dpp
    I have a class derived from a Form, it has textbox for username and password and an OK button. I want it to behave like an InputBox so I can use it like this: Dim Username As String = "" Dim Password As String = "" Dim authorization As New Authorization(Username, Password) authorization.ShowDialog() 'The user will click OK and I will expect the Username and Password to change based on the user input MsgBox(Username & " " & Password) The Authorization class: Public Class Authorization Dim RefUsername As String Dim RefPassword As String Public Sub New(ByRef Username As String, ByRef Password As String) InitializeComponent() RefUsername = Username 'I'm trying to pass reference instead of value RefPassword = Password 'I'm trying to pass reference instead of value End Sub Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AuthorizeButton.Click RefUsername = Username.Text 'I'm trying to change value of variable outside the class RefPassword = Password.Text 'I'm trying to change value of variable outside the class Me.Close() End Sub End Class In short, I want to change the value of variables outside the class when the user clicks the OK, how am I going to accomplish that?

    Read the article

  • Problem using GDI+ with multiple threads (VB.NET)

    - by Joe B
    I think it would be best if I just copy and pasted the code (it's very trivial). Private Sub Main() Handles MyBase.Shown timer.Interval = 10 timer.Enabled = True End Sub Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint e.Graphics.DrawImage(image, 0, 0) End Sub Private Sub tick() Handles timer.Elapsed Using g = Graphics.FromImage(image) g.Clear(Color.Transparent) g.DrawLine(Pens.Red, 0 + i, 0 + i, Me.Width - i, Me.Height - i) End Using Me.Invalidate() End Sub An exception, "The object is currently in use elsewhere", is raised during the tick event. Could someone tell me why this happens and how to solve it? Thanks.

    Read the article

  • referencing files that were included with vb.net solution

    - by every_answer_gets_a_point
    my application builds a pdf with images in the solution explorer i added a folder called pics and dropped all the images there when i run the program from my computer, there are no problems, but when i had a different user install the application they get this error: here's how i am including the image: Dim jpeg2 As Image = Image.GetInstance(Application.StartupPath & "\pics\1.jpg") i am using the itextsharp library why is the user having this problem?

    Read the article

  • vb.net press/release keys

    - by Cyclone
    How can you simulate keypresses and releases? I know you can essentially hit a key with Sendkeys.SendWait, but how can your code press and hold q, for example? Any help is much appreciated! Everything I find keeps pointing me at sendkeys, which is not correct. I essentially wish to be able to call something like press("q") and release("q"). The effect would be the same as physically holding them down. Thanks for your help!

    Read the article

  • Start Line with (New... in VB.net

    - by pedro_cesar
    Hello; Why can't I start a line using a parenthesis followed by the keyword new?? For example: (New <custom_obj>).foo(var) In that case is obvious that I'm trying to avoid creating a named instance of the the <custom_obj> because I know that I'll only be using it at that sentence. Note that actually creating a named instance is not a problem for me... I just wanna know the reason why this is not possible.

    Read the article

  • How to select a single object using Linq in vb.net

    - by Hucker
    I have done a lot of searching to what appears to be a simple LINQ problem but I can't figure out how to do grab an object out of a collection that has a specified minimum (or max value) without resorting to a sort like this: > dim customers= GetCustomers() > > dim youngest = (From c in customers > Order By c.age Ascending).ToList.First This (untested code) structure works fine with the exception that the entire customer array must be sorted and placed into a list for the only purpose of extracting the first value. That can't be the best way to get the minimum! Note that I want the whole c record in this case, not the minumum age of a customer that can be done like this (a typical example): > dim customers= GetCustomers() > > dim youngest = (From c in customers > Select c.age).Min Or even > dim customers= GetCustomers() > > dim youngest = (From c in customers > Select c).Min(Function(x) x.age) I can't for the life of me figure out how to get the whole object (or even the index) without resorting to the sort...

    Read the article

  • VB.NET Abstract Property

    - by ElPresidente
    I have an abstract "GridBase" class with two types of derived classes "DetailGrid" and "HeaderGrid". Respectively, one is comprised of "DetailRow" objects and the other "HeaderRow" objects. Both of those inherit from a "RowBase" abstract class. What I am trying to do is the following: Public MustInherit Class GridBase Private pRows As List(Of RowBase) Public ReadOnly Property Rows As List(Of RowBase) Get Return pRows End Get End Property End Class Public Class DetailGrid Inherits GridBase End Class In this scenario, I want DetailGrid.Rows to return a list of DetailRow. I want HeaderRow.Rows to return a list of HeaderRow. Am I on the right track with this or should the Rows property not be included in the GridBase class?

    Read the article

  • VB looping complication

    - by user1819469
    I have to come up with a program that shifts names in a text box a random amount of times. I have gotten everything up to the point where the names shifts a random amount of times. It only shifts its once, but my messagebox appears through the code as many times as the names should be shifting once i click ok. Does anyone know why the loop is not working for the name shifts. I was thinking maybe the messagebox needs to control the loop, but I have searched endlessly and cannot find how that would be done. Any suggestions or referrals to other sites would be nice thanks. My code is below. Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim RandomNumber As Integer Dim min, max As Integer Dim temp, temp2, temp3, temp4, temp5, temp6 As String Dim i As Integer min = 3 max = 11 Randomize() RandomNumber = Int((max - min + 1) * Rnd() + min) temp = n1.Text temp2 = n2.Text temp3 = n3.Text temp4 = n4.Text temp5 = n5.Text temp6 = n6.Text For i = 0 To RandomNumber - 1 n1.Text = temp6 n2.Text = temp n3.Text = temp2 n4.Text = temp3 n5.Text = temp4 n6.Text = temp5 MessageBox.Show("Shift " & i & " of " & RandomNumber & " complete") Next End Sub End Class

    Read the article

  • VB.NET Incrementing Indexes

    - by Daniel
    Hello, I am having trouble incrementing the indexes of my list item properties. Here is the code. Dim i As Integer = 0 For x As Integer = 1 To list.Count / 19 database.ExecuteCommand("INSERT INTO Contacts VALUES ('" + _ list.Item(i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "', '" + _ list.Item(++i) + "')") Next The ++i does not increment at all in the parameters. Thanks

    Read the article

  • Nullable object must have a value. VB.NET

    - by Glenn05
    I need help. I'm having problem in my program. This is my code on my Business logic layer. Function Load_ItemDetails(ByVal ItemID As String) As Items Dim objItemEnt As New tblitem Dim objitem As New Items Try Using da = New DataAccess objItemEnt = da.Load_ItemDetails(ItemID) With objitem .ItemCode = objItemEnt.ItemCode .ItemName = objItemEnt.ItemName .Description = objItemEnt.Description .NameofType = objItemEnt.NameofType .TypeofPricing = objItemEnt.TypeofPricing .OnStock = objItemEnt.OnStock .ItemPrice = objItemEnt.ItemPrice .DateModified = objItemEnt.DateModified End With Return objitem End Using Catch ex As Exception Throw End Try End Function This code is for my data access layer. Public Function Load_ItemDetails(ByVal ItemCode As String) Dim objitem As New tblitem Try Using entItem = New DAL.systemdbEntities1 Dim qryUsers = From p In entItem.tblitems Where p.ItemCode = ItemCode Select p Dim luser As List(Of tblitem) = qryUsers.ToList If luser.Count > 0 Then Return luser.First Else Return objitem End If End Using Catch ex As Exception Throw End Try End Function` For my Presentation layer: Private Sub Load_Item_Detail(ByVal ItemCode As String) objItem = New Items Using objLogic = New LogicalLayer objItem = objLogic.Load_ItemDetails(ItemCode) With objItem Me.ItemCodetxt.Text = .ItemCode Me.ItemNametxt.Text = .ItemName Me.ItemDesctxt.Text = .Description Me.ItemTypetxt.Text = .NameofType Me.ItemPricetxt.Text = .TypeofPricing Me.ItemOnstocktxt.Text = CStr(.OnStock) Me.ItemPricetxt.Text = CStr(.ItemPrice) Me.TextBox1.Text = CStr(.DateModified) Me.ItemCodetxt.Tag = .ItemCode End With End Using End Sub` and after I run, I get this error Nullable object must have a value help me. I'm stuck. I don't know what to do guys. I new in n tier architecture.

    Read the article

  • VB.NET 2008 Application crashing during Do Loop

    - by RedHaze
    I am writing an application to compare each item on listbox1 to all items on listbox2. If the item is found, then remove it from both lists. The goal is to only have the items that were not found remain on both lists. The problem is, the application just hangs and I never get any results. I looked at my code several times and I cannot figure out what's going on (programming noob I know...). Can anybody help me with this? Code Snippet: Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim a As String Dim b As String Dim y As String For i As Integer = 0 To ListBox1.Items.Count - 1 a = ListBox1.Items(i) y = 1 Do While y = 1 For x As Integer = 0 To ListBox2.Items.Count - 1 b = ListBox2.Items(x) Dim res As Int16 = String.Compare(a, b) If res = 0 Then y = 0 ListBox2.Items.Remove(i) ListBox2.Items.Remove(x) ElseIf x = ListBox1.Items.Count Then Exit Do End If Next Loop Next End Sub

    Read the article

  • None of my Win Forms buttons work

    - by nectarines
    I have a windows form which connects to a SQL Server though a dataset. The form was working fine since my last compile. All of a sudden, none of my buttons work! The data is loaded on the form, all the tabs work fine, drop down boxes work fine, but the buttons are literally unresponsive to any clicks. I added a test button and I get the same results. I can visually see the button getting clicked but no events. Any ideas?

    Read the article

  • vb.net datadrig view get each cell value

    - by Gbolahan
    hello i'm trying to get the first value of a datagrid cell value but it keeps looping trough and returns the last value. here is the code: Dim cell As DataGridViewCell txtoccupier.Text = "" Try For Each cell In dgvREcord.CurrentRow.Cells() txtoccupier.Text = cell.Value.ToString Next Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Exit Try End Try record eample: id name email 1 test [email protected] it returns only [email protected] but i want to get only the id which is 1 thanks for your help

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >