Search Results

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

Page 22/179 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Stop the screen saver and hibernation temporarily in VB.Net

    - by Tim Santeford
    I have a very long running syncronization task that cannot be interrupted by the screen saver or aggressive power saving modes. I want to make a single api call to stop power save mode and then restore it once the task is done. The following code is peaced together from various other posts but it has no effect on XP's power management settings. What am I doing wrong? TIA! Private Declare Function SetThreadExecutionState Lib "kernel32" (ByVal esFlags As Long) As Long Public Enum EXECUTION_STATE As Integer ES_CONTINUOUS = &H80000000 ES_DISPLAY_REQUIRED = &H2 ES_SYSTEM_REQUIRED = &H1 ES_AWAYMODE_REQUIRED = &H40 End Enum Public Shared Sub PowerSaveOff() SetThreadExecutionState(EXECUTION_STATE.ES_DISPLAY_REQUIRED Or EXECUTION_STATE.ES_CONTINUOUS) End Sub Public Shared Sub PowerSaveOn() SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS) End Sub Here are the systems screensaver and powermode settings:

    Read the article

  • Using returned XML from an authorised HTTP request in vb.NET

    - by Nathan
    Hi, How can I use the returned XML from the reader in a xmltextreader? ' Create the web request request = DirectCast(WebRequest.Create("https://mobilevikings.com/api/1.0/rest/mobilevikings/sim_balance.xml"), HttpWebRequest) ' Add authentication to request request.Credentials = New NetworkCredential("username", "password") ' Get response response = DirectCast(request.GetResponse(), HttpWebResponse) ' Get the response stream into a reader reader = New StreamReader(response.GetResponseStream()) Thanks in advance, Nathan.

    Read the article

  • Reading XML element & child nodes using LINQ in Vb.net- help me in where condition :(

    - by New Linq Baby
    Hi, I am new in LINQ world. I need an urgent help in reading the xml elements using LINQ with specific where condition. I need to find the max air_temp for a county i.e where county name = "Boone" and hour id = "06/03/2009 09:00CDT" i tried something like below, but no luck : Dim custs As IEnumerable = From c In Element.Load("C:\meridian.xml").Elements("county") _ Select c.Elements("hour").Elements("air_temp").Max() For Each x In custs Response.Write(custs(0).ToString()) Next ------------------- here is the xml file : <forecasts> <issued>06/02/2009 12:00CDT</issued> - <county name="Adair"> - <hour id="06/02/2009 12:00CDT"> <air_temp>61</air_temp> <cloud_cover>overcast</cloud_cover> <dew_point>59</dew_point> <precip_prob>90</precip_prob> <precip_rate>0.12</precip_rate> <precip_type>rain</precip_type> <snow_rate>0.0</snow_rate> <wind_direction>NE</wind_direction> <wind_speed>12</wind_speed> <dew_point_confidence>-3/+3</dew_point_confidence> <road_temp>64</road_temp> <road_frost_prob>0</road_frost_prob> <road_potential_evap_rate>429</road_potential_evap_rate> <road_temp_confidence>-3/+2</road_temp_confidence> <dew_point_confidence>-3/+3</dew_point_confidence> <bridge_temp>63</bridge_temp> <bridge_temp_confidence>-4/+2</bridge_temp_confidence> <bridge_frost>NO</bridge_frost> </hour> - <hour id="06/02/2009 13:00CDT"> <air_temp>61</air_temp> <cloud_cover>overcast</cloud_cover> <dew_point>60</dew_point> <precip_prob>70</precip_prob> <precip_rate>0.01</precip_rate> <precip_type>rain</precip_type> <snow_rate>0.0</snow_rate> <wind_direction>ENE</wind_direction> <wind_speed>10</wind_speed> <dew_point_confidence>-3/+3</dew_point_confidence> <road_temp>65</road_temp> <road_frost_prob>0</road_frost_prob> <road_potential_evap_rate>411</road_potential_evap_rate> <road_temp_confidence>-3/+2</road_temp_confidence> <dew_point_confidence>-3/+3</dew_point_confidence> <bridge_temp>64</bridge_temp> <bridge_temp_confidence>-4/+1</bridge_temp_confidence> <bridge_frost>NO</bridge_frost> </hour>

    Read the article

  • Filter a wpf collectionviewsource in VB?

    - by Johnny Westlake
    Hi, I want to filter a collectionviewsource using a filter I've written, but I'm not sure how I can apply the filter to it? Here is my collection view source: <Grid.Resources> <CollectionViewSource x:Key="myCollectionView" Source="{Binding Path=Query4, Source={x:Static Application.Current}}"> <CollectionViewSource.SortDescriptions> <scm:SortDescription PropertyName="ContactID" Direction="Descending"/> </CollectionViewSource.SortDescriptions> </CollectionViewSource> </Grid.Resources> I have implemented a filter as such: Private Sub WorkerFilter(ByVal sender As Object, ByVal e As FilterEventArgs) Dim value As Object = CType(e.Item, System.Data.DataRow)("StaffSection") If (Not value Is Nothing) And (Not value Is DBNull.Value) Then If (value = "Builder") Or (value = "Office Staff") Then e.Accepted = True Else e.Accepted = False End If End If End Sub So how can I get the CollectionViewSource filtered by the filter on load? Could you please give all hte code I need (only a few lines I figure) as I'm quite new to coding. Thanks guys EDIT: For the record, <CollectionViewSource x:Key="myCollectionView" Filter="WorkerFilter" ... /> gives me the error: Failed object initialization (ISupportInitialize.EndInit). 'System.Windows.Data.BindingListCollectionView' view does not support filtering. Error at object 'myCollectionView'

    Read the article

  • VB FFT - stuck understanding relationship of results to frequency

    - by WaveyDavey
    Trying to understand an fft (Fast Fourier Transform) routine I'm using (stealing)(recycling) Input is an array of 512 data points which are a sample waveform. Test data is generated into this array. fft transforms this array into frequency domain. Trying to understand relationship between freq, period, sample rate and position in fft array. I'll illustrate with examples: ======================================== Sample rate is 1000 samples/s. Generate a set of samples at 10Hz. Input array has peak values at arr(28), arr(128), arr(228) ... period = 100 sample points peak value in fft array is at index 6 (excluding a huge value at 0) ======================================== Sample rate is 8000 samples/s Generate set of samples at 440Hz Input array peak values include arr(7), arr(25), arr(43), arr(61) ... period = 18 sample points peak value in fft array is at index 29 (excluding a huge value at 0) ======================================== How do I relate the index of the peak in the fft array to frequency ?

    Read the article

  • Capturing IR Data using VB.NET

    - by E-Q
    Just found an old IR reciever (Microsoft eHome Infared Transceiver) and i'm trying to write an application that can use data it captures... Any examples or jumping off points for this are appreciated. Thanks!

    Read the article

  • IP Address Lookup in VB.net (XP vs Windows 7)

    - by TheHockeyGeek
    Currently I use the following code to retrieve the IP address of the local workstation... strIPAddress = System.Net.Dns.GetHostEntry(strComputerName).AddressList(0).ToString() This is fine for the Windows XP workstations. However, in Vista and Windows 7, this returns the IPv6 address which is not used at all. Is there a method of setting this to work so it always returns the IPv4 address regardless of platform? I know I can increment the AddressList value to 1 and get the correct IP in Windows 7. The bad part is that this requires going through the motions of identifying the OS and choosing one or the other. The must be some way of specifying IPv4 only. Perhaps getting a result from DNS on the network rather than the workstation itself?

    Read the article

  • Declaring variables with New DataSet vs DataSet

    - by eych
    What is the impact of creating variables using: Dim ds as New DataSet ds = GetActualData() where GetActualData() also creates a New DataSet and returns it? Does the original empty DataSet that was 'New'ed just get left in the Heap? What if this kind of code was in many places? Would that affect the ASP.NET process and cause it to recycle sooner?

    Read the article

  • VB restart form

    - by hiba salem
    I created a button and I need it to restart the form I have no idea how to work on the sily visual basic what should i write Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End Sub

    Read the article

  • vb.net using SortedDictionary as combobox datasource

    - by user228058
    I have a combobox which i am binding to a sortedDictionary list, so it displays in ascending order. My question is, I need to display "--Select--" as the first option. Is there any way to either: 1) add another item besides for the datasource or 2) add an unsorted item to the top of the sortedDictionary any other ideas welcome as well :) TIA

    Read the article

  • VB.net Debug sqldatareader - immediate window

    - by ScaryJones
    Scenario is this; I've a sqldatareader query that seems to be returning nothing when I try to convert the sqldatareader to a datatable using datatable.load. So I debug into it, I grab the verbose SQL query before it goes into the sqldatareader, just to make sure it's formatted correctly. I copy and paste this into SQL server to run it and see if it returns anything. It does, one row. I go back to visual studio and let the program continue, I create a datatable and try to load the sqldatareader but it just returns an empty reader. I'm baffled as to what's going on. I'll copy a version of the code (not the exact SQL query I'm using but close) here: Dim cn As New SqlConnection cn.ConnectionString = <connection string details here> cn.Open() Dim sqlQuery As String = "select * from Products where productid = 5" Dim cm As New SqlCommand(sqlQuery, cn) Dim dr As SqlDataReader = cm.ExecuteReader() Dim dt as new DataTable dt.load(dr) dt should have contents but it's empty. If I copy that SQL query into sql server and run it I get a row of results. Any ideas what I'm doing wrong? ######### UPDATE ############ I've now noticed that it seems to be returning one less row than I get with each SQL query. So, if I run the SQL myself and get 1 row then the datatable seems to have 0 rows. If the query returns 4 rows, the datatable has 3!! Very strange, any ideas anyone?

    Read the article

  • Simplify CASE in VB.net code

    - by StealthRT
    Hey all, i am looking here to see if anyone would have a better way to acomplish this task below in less code. Select Case mainMenu.theNumOpened Case 1 Me.Text = "NBMsg1" Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5) Case 2 Me.Text = "NBMsg2" Dim hwnd As IntPtr = FindWindow(vbNullString, "NBMsg1") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, Me.Height + 10, 0, 0, 1) Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5) Case 3 Me.Text = "NBMsg3" Dim hwnd As IntPtr = FindWindow(vbNullString, "NBMsg2") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, Me.Height + 10, 0, 0, 1) hwnd = FindWindow(vbNullString, "NBMsg1") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 2) + 15, 0, 0, 1) Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5) Case 4 Me.Text = "NBMsg4" Dim hwnd As IntPtr = FindWindow(vbNullString, "NBMsg3") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, Me.Height + 10, 0, 0, 1) hwnd = FindWindow(vbNullString, "NBMsg2") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 2) + 15, 0, 0, 1) hwnd = FindWindow(vbNullString, "NBMsg1") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 3) + 20, 0, 0, 1) Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5) Case 5 Me.Text = "NBMsg5" Dim hwnd As IntPtr = FindWindow(vbNullString, "NBMsg4") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, Me.Height + 10, 0, 0, 1) hwnd = FindWindow(vbNullString, "NBMsg3") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 2) + 15, 0, 0, 1) hwnd = FindWindow(vbNullString, "NBMsg2") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 3) + 20, 0, 0, 1) hwnd = FindWindow(vbNullString, "NBMsg1") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 4) + 25, 0, 0, 1) Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5) Case 6 Me.Text = "NBMsg6" Dim hwnd As IntPtr = FindWindow(vbNullString, "NBMsg5") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, Me.Height + 10, 0, 0, 1) hwnd = FindWindow(vbNullString, "NBMsg4") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 2) + 15, 0, 0, 1) hwnd = FindWindow(vbNullString, "NBMsg3") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 3) + 20, 0, 0, 1) hwnd = FindWindow(vbNullString, "NBMsg2") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 4) + 25, 0, 0, 1) hwnd = FindWindow(vbNullString, "NBMsg1") SetWindowPos(hwnd, 0, My.Computer.Screen.WorkingArea.Width - 302, (Me.Height * 5) + 30, 0, 0, 1) Me.SetDesktopLocation(My.Computer.Screen.WorkingArea.Width - 302, 5) Case Else Me.Close() Me.Dispose() End Select What it does is pass to it now many windows are currently already opened. So if one then of course it goes to case 1. If there are 2 opened then it moves the oldest down and puts the newest on top. etc etc. I have set it so that a max of 6 boxes can only be opened at one time. If anyone knows how i could also "slide" them down (kinda like an effect of jQuery) then that would also be, well awesome to know! :o) Any help/suggestions would be great! :o) David

    Read the article

  • VB.NET GroupBy LINQ statement

    - by Jason
    I am having a bear of a time getting this to work. I have a List(Of MyItem) called Items that have a OrderId property on them. From those items, I want to create a list of Orders. Some items will have the same OrderId so I want to try to group by OrderId. I then want to sort by date. Here's what I have so far: Public ReadOnly Property AllOrders() As List(Of Order) Get Return Items.Select(Function(i As MyItem) New Order(i.OrderID)) _ .GroupBy(Function(o As Order) New Order(o.OrderID)) _ .OrderBy(Function(o As Order) o.DateOrdered).ToList End Get End Property This, of course, doesn't compile, and I get the error: Value of type 'System.Collections.Generic.List(Of System.Linq.IGrouping(Of Order, Order))' cannot be converted to 'System.Collections.Generic.List(Of Order))' I've bolded the part where I think the problem is, but I have no idea how to fix it. Also, it used to work fine (except there were duplicate values) before I added the .GroupBy statement. Anyone have any ideas? Thanks

    Read the article

  • Displaying Many-To-Many Database relationship in VB.NET 2008 with DataGrid, MS SQL 2008

    - by user337501
    Computer bombed while posting this, couldnt find a duplicate question but if there is one, forgive me. So, I've run into a wall. And rather than use a ladder to avoid it, I'd like go through it. I'm setting up what I can best describe as a many-to-many relationship in a database. To examplify, imagine I have three primary tables: Items, Categories, Sections(nevermind the potential redundancy) Then I have another table, Properties. Items, Categories, and Sections can be associated with many properties. A single property can be associated with one, all, or none of the other tables. The best way I can figure to do this is to have join tables make the relationship. i.e. tblItems----(Foreign Key)----tblItems_To_Properties----(Foreign Key)----tblProperties In this example, tblItems simply has an "ItemID" Primary Key. tblItems_To_Properties has its own Primary Key(tblItems_To_PropertiesID), a Foreign Key to the Item(ItemID) and a Foreign key to the Property(PropertyID). The Properties table simply has its primary key(PropertyID) I hope this example isnt too confusing...if I have to I can find a way to put a diagram up or something. My problem is, I want to display this in a DataGrid using the Master-Detail method(DevExpress GridControl). I use the tblItems as a test, and I can see the Items in the parent view, but in the child view I see(understandably) the join table and that is it. My goal is to make it so the Grid ignores the join table and shows the Properties table as the only child. Any help on this method or insight into another solution would be muuuuuuuch appreciat

    Read the article

  • N-Tier Architecture - Structure with multiple projects in VB.NET

    - by focus.nz
    I would like some advice on the best approach to use in the following situation... I will have a Windows Application and a Web Application (presentation layers), these will both access a common business layer. The business layer will look at a configuration file to find the name of the dll (data layer) which it will create a reference to at runtime (is this the best approach?). The reason for creating the reference at runtime to the data access layer is because the application will interface with a different 3rd party accounting system depending on what the client is using. So I would have a separate data access layer to support each accounting system. These could be separate setup projects, each client would use one or the other, they wouldn't need to switch between the two. Projects: MyCompany.Common.dll - Contains interfaces, all other projects have a reference to this one. MyCompany.Windows.dll - Windows Forms Project, references MyCompany.Business.dll MyCompany.Web.dll - Website project, references MyCompany.Business.dll MyCompany.Busniess.dll - Business Layer, references MyCompany.Data.* (at runtime) MyCompany.Data.AccountingSys1.dll - Data layer for accounting system 1 MyCompany.Data.AccountingSys2.dll - Data layer for accounting system 2 The project MyCompany.Common.dll would contain all the interfaces, each other project would have a reference to this one. Public Interface ICompany ReadOnly Property Id() as Integer Property Name() as String Sub Save() End Interface Public Interface ICompanyFactory Function CreateCompany() as ICompany End Interface The project MyCompany.Data.AccountingSys1.dll and MyCompany.Data.AccountingSys2.dll would contain the classes like the following: Public Class Company Implements ICompany Protected _id As Integer Protected _name As String Public ReadOnly Property Id As Integer Implements MyCompany.Common.ICompany.Id Get Return _id End Get End Property Public Property Name As String Implements MyCompany.Common.ICompany.Name Get Return _name End Get Set(ByVal value as String) _name = value End Set End Property Public Sub Save() Implements MyCompany.Common.ICompany.Save Throw New NotImplementedException() End Sub End Class Public Class CompanyFactory Implements ICompanyFactory Public Function CreateCompany() As ICompany Implements MyCompany.Common.ICompanyFactory.CreateCompany Return New Company() End Function End Class The project MyCompany.Business.dll would provide the business rules and retrieve data form the data layer: Public Class Companies Public Shared Function CreateCompany() As ICompany Dim factory as New MyCompany.Data.CompanyFactory Return factory.CreateCompany() End Function End Class Any opinions/suggestions would be greatly appreciated.

    Read the article

  • How to split string in group in vb.net

    - by amol kadam
    Hi. i'm amol kadam,I want to know how to split string in two part.My string is in Time format (12:12).& I want to seperate this in hour & minute format.the datatype for all variables are string. for hour variable used strTimeHr & for minute strTimeMin .I tried below code but their was a exception "Index and length must refer to a location within the string. Parameter name: length" If Not (objDS.Tables(0).Rows(0)("TimeOfAccident") Is Nothing Or objDS.Tables(0).Rows(0)("TimeOfAccident") Is System.DBNull.Value) Then strTime = objDS.Tables(0).Rows(0)("TimeOfAccident") 'strTime taking value 12:12 index = strTime.IndexOf(":") 'index taking value 2 lastIndex = strTime.Length 'Lastindex taking value 5 strTimeHr = strTime.Substring(0, index) 'strTime taking value 12 correctly strTimeMin = strTime.Substring(index + 1, lastIndex) 'BUT HERE IS PROBLEM OCCURE strTimeMin Doesn't taking any value Me.NumUpDwHr.Text = strTimeHr Me.NumUpDwMin.Text = strTimeMin End If

    Read the article

  • Problems refreshing DataGridView after database update in VB.NET

    - by Gbolahan
    Dim myQuery = "UPDATE table1 SET data= CONCAT (data,'" & vbCrLf & "[ " & Date.Now() & " ]" & " " & "[" & getCN() & "]" & " " & txtTelenotes.Text & "[ item1 ]" & "') WHERE id='" & txtID.Text & "'" myCommand.Connection = conn myCommand.CommandText = myQuery myAdapter.SelectCommand = myCommand Dim myData As MySqlDataReader myData = myCommand.ExecuteReader() txtTelenotes.Text = "" dgvREcord.Refresh() I tried refreshing the DataGridView using: dgvREcord.Refresh() but it does not load the changes from the database.

    Read the article

  • convert VB code to C# help please??

    - by ilkdrl
    var aktif=0, gosterim_adeti=5; var dizi = new Array(); $(document).ready(function(){ var boyut = $("#alan p").length; for(var i=0; i<boyut; i++) { dizi[i] = $("#alan p:eq("+i+")").html(); } $("#alan").html(""); for(var i=0; i<gosterim_adeti; i++) { $("#alan").append("<p>"+dizi[i]+"</p>"); } setInterval(degistir, 2000); function degistir() { aktif = (aktif + 1)%boyut; $("#alan").html(""); var ilk = aktif-1; if(ilk<0)ilk = ilk+boyut; $("#alan").append("<p>"+dizi[ilk]+"</p>"); for(var i=aktif; i<aktif + gosterim_adeti;i++) { $("#alan").append("<p>"+dizi[(i%boyut)]+"</p>"); } $("#alan p:first").slideUp(500); $("#alan p:last").css("height","0px").animate({height:"40px"},600);

    Read the article

  • vb.net pdf reader load problem

    - by steve
    From the tools menu I have done right clickchoose itemCOM (tab) and ticked adobe pdf reader. From here I simply dragged the pdf tool onto my form. That's all I've done. Now on form load it throws a bug. "InvalidOperationException was unhandled" hovering over the message it says the following, An error occurred creating the form. See Exception.InnerException for details. The error is: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) Any ideas anyone? Gonna take a mastermind to work this one out seriously

    Read the article

  • VB.NET add an element to the XML document with LINQ to XML

    - by Bayonian
    Hi, I'm adding an element to existing XML doc with the following code: Dim theXMLSource As String = Server.MapPath("~/Demo/") & "LabDemo.xml" Dim nodeElement As XElement Dim attrAndValue As XElement = _ <LabService> <ServiceType> <%= txtServiceType.Text.Trim %> </ServiceType> <Level> <%= txtLevel.Text.Trim %> </Level> </LabService> nodeElement.Add(New XElement(attrAndValue)) nodeElement.Save(theXMLSource) It makes error like this: System.NullReferenceException: Object reference not set to an instance of an object. Object reference not set to an instance of an object. Error line: nodeElement.Add(New XElement(attrAndValue)) I debugged it but I couldn't get the error yet. Can you show what the problem is? Thank you

    Read the article

  • Long overdue (for me) question about disposing managed objects in .Net, VB.Net, C#

    - by Jules
    I can't believe I'm still confused about this but, any way, lets finally nail it: I have a class that overrides OnPaint to do some drawing. To speed things up, I create the pens, brushes etc before hand, in the construtor, so that OnPaint does not need to keep creating and disposing them. Now, I make sure that I always dispose of such objects, but I have the feeling I don't need to because, despite the fact they implement IDisposable, they're managed objects. Is this correct?

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >