Search Results

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

Page 115/179 | < Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >

  • LINQ Query based on user preferences

    - by Chris Phelps
    How can I do this better (so it actually works : ) I have a LINQ Query that includes an order by that is based on a user preference. The user can decide if they would like the results ordered asc or desc. If fuserclass.SortOrder = "Ascending" Then Dim mydat = (From c In dc.ITRS Order By c.Date Ascending Select c) Else Dim mydat = (From c In dc.ITRS Order By c.Date Descending Select c) End If For each mydata in mydat ***<<<error "mydat is not declared"*** I know I could put my For Each loop inside the If and Else, but that seems silly to have the same code twice. I know you know of a better way : )

    Read the article

  • Getting data from ListView control

    - by James
    I need to retrieve my data from a ListView control set up in Details mode with 5 columns. I tried using this code: MessageBox.Show(ManageList.SelectedItems(0).Text) And it works, but only for the first selected item (item 0). If I try this: MessageBox.Show(ManageList.SelectedItems(2).Text) I get this error: InvalidArgument=Value of '2' is not valid for 'index'. Parameter name: index I have no clue how I can fix this, any help? Edit: Sorry, should have said, I'm using Windows.Forms :)

    Read the article

  • How listview delete data in database

    - by Bud33
    I have a problem to delete data in listview, I was able to delete data in listview select record, but data which selected is not deleted in the database, I have a source code Private _updateinputalltrans As Boolean Private Sub btndelete_Click(sender As System.Object, e As System.EventArgs) Handles btndelete.Click With Me.listviewpos.SelectedItem .Remove() End With MessageBox.Show("Are you sure delete this record?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, New EventHandler(AddressOf DeleteData)) End Sub Private Sub DeleteData(ByVal sender As Object, ByVal e As EventArgs) Dim conn As New Connection(Connectiondb) If Me.updateinputalltrans = False Then If Me.listviewpos.Items.Count > 0 Then For Each del As ListViewItem In listviewpos.Items conn.delete_dtpospart(del.Text) Next End If End If End Sub delete_dtpospart a declare which connection to the database using a stored procedure

    Read the article

  • What is a practical usage of Code Contracts in .NET 4.0?

    - by Will Marcouiller
    In order to fully understand and take advantage of the new features and enhancements provided with the coming of the new .NET Framework 4.0, I would like to get an example of real-world application of the Code Contracts. Anyone has a good example of application of this feature? I would like to get a code sample with a brief explanation to help me get up and running with it. Thanks! =)

    Read the article

  • Getting the data out of the data Formview

    - by QEDDave
    I have an ASP pg with a formview list control on it that hooks up to a sql database customer table I want to access the customer name outside the form. How do I: A) access the bound text box in the form view template? Something like Text1.text=formview1.customername.text (that doesn't work but that's the kinda thing) B) access the database field in the table that the sqlsource connects to to feed the formview Really appreciate the help. I bet it's easy to do but I'm just not getting there.

    Read the article

  • Proper code but can't insert to database

    - by Dchris
    I have a Visual Basic project using Access database.I run a query but i don't see any new data on my database table.I don't have any exception or error.Instead of this the success messagebox is shown. Here is my code: Dim ID As Integer = 2 Dim TableNumber As Integer = 2 Dim OrderDate As Date = Format(Now, "General Date") Dim TotalPrice As Double = 100.0 Dim ConnectionString As String = "myconnectionstring" Dim con As New OleDb.OleDbConnection(ConnectionString) Try Dim InsertCMD As OleDb.OleDbCommand InsertCMD = New OleDb.OleDbCommand("INSERT INTO Orders([ID],[TableNumber],[OrderDate],[TotalPrice]) VALUES(@ID,@TableNumber,@OrderDate,@TotalPrice);", con) InsertCMD.Parameters.AddWithValue("@ID", ID) InsertCMD.Parameters.AddWithValue("@TableNumber", TableNumber) InsertCMD.Parameters.AddWithValue("@OrderDate", OrderDate) InsertCMD.Parameters.AddWithValue("@TotalPrice", TotalPrice) con.Open() InsertCMD.ExecuteNonQuery() MessageBox.Show("Successfully Added New Order", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information) con.Close() Catch ex As Exception 'Something went wrong MessageBox.Show(ex.ToString) Finally 'Success or not, make sure it's closed If con.State <> ConnectionState.Closed Then con.Close() End Try What is the problem?

    Read the article

  • Problem using OLEDBCOMMANDBUILDER.

    - by Lullly
    So, here it goes: I need to copy data from table in access database, in another table from another access database. Column names from tables are the same, except the fact that the FROM table has 5 columns, the TO table has 6. here is my code: dsFrom.Clear() dsTO.Clear() daFrom = Nothing daTO = Nothing conn_string1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="etc.mdb;" conn_string2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="database.mdb;" query1 = "Select * from nomenclator_produse" query2 = "Select * from nomenclator_produse" Conn1 = New OleDbConnection(conn_string1) conn2 = New OleDbConnection(conn_string2) Conn1.Open() conn2.Open() daFrom = New OleDbDataAdapter(query1, Conn1) daTO = New OleDbDataAdapter(query2, conn2) daFrom.AcceptChangesDuringFill = False dsFrom.HasChanges() daFrom.Fill(dsFrom, "nomenclator_Produse") dsFrom.HasChanges() Dim cb = New OleDbCommandBuilder(daFrom) dsTO = dsFrom.Copy daTO.UpdateCommand = cb.GetUpdateCommand daTO.InsertCommand = cb.GetInsertCommand daTO.Update(dsTO, "nomenclator_produse") Because the FROM table has 5 rows and the other has 6, i'm trying to use the InsertCommand generated by the DataAdapter of the first table. It works, only that it inserts the data from the FROMTABLE in the same FROMTABLE, instead of TOTABLE. :| please help me :(

    Read the article

  • Picture Box and Form Transparency

    - by Qu1nncunxIV
    Maybe I am missing something, but is it the case that when you set a pictureboxes background to transparent, all it really does is set it to the same color as the forms background? What I am trying to do is draw an animation for the benefit of this, a bouncing ball - which I paint on the form, then overlay that with a picture frame. End result should be a bouncing ball in a picture frame, I should mention that the picture frame does not have a straight edge, so it is not possible to arrange 4 picture boxes in a frame. The ball needs to vanish behind the frame to change color and then magically bounce back out. I have tried: 1.Setting the picture box background to pink and then key out the same pink, this basically cuts away everything, including that which is behind the picture box 2.Setting the picture box to transparent, this just displays the picture box background as the same color as the forms background. 3.I have tried painting the image in a rectangle, this had the same effect as drawing it in a picture box. I am not sure what I am doing wrong, I am wondering if there is any other ways I could try or if someone has made a custom control or library that supports transparency?

    Read the article

  • control.focus() after selectedIndexChanged

    - by kyle
    I need to focus on a textbox after an item has been selected from a dropdownlist. I've tried control.focus() and setfocus(). The last thing I've tried was Set_Focus(dtbEffectiveDate.ClientID) inside the SelectedIndexChanged method with the folowing method. Protected Sub Set_Focus(ByVal ControlName As String) Dim strScript As String strScript = "<script language=javascript> window.setTimeout(""" + ControlName + ".focus();"",0); </script>" RegisterStartupScript("focus", strScript) End Sub I'm out of answers so any help would be awesome.

    Read the article

  • Parse CSS out from <style> elements

    - by awj
    Can someone tell me an efficient method of retrieving the CSS between tags on a page of markup in .NET? I've come up with a method which uses recursion, Split() and CompareTo() but is really long-winded, and I feel sure that there must be a far shorter (and more clever) method of doing the same. Please keep in mind that it is possible to have more than one element on a page, and that the element can be either or .

    Read the article

  • Mouse Events lost on zoom in silverlight

    - by Ged
    Hi All, I'm running into an issue where I seem to be losing mouse events. Essentially I have a grid with a bunch of controls that get refreshed (removed/re-added via Grid.Children.Clear and Grid.Children.Add(control) ) via a WCF_Service. If I zoom in to a part of the grid where no control exists, I'm unable to zoom out. I have implemented zoom to mouse position but have logic to ensure the coordinates of the grid are never beyond the window of screen. (Eg: Grid.ActualWidth must be 0 and Translate.X must be < Grid.ActualWidth - 200) I have also experienced this where I can still see a section of one of the controls, but it still is not able to zoom out (unless I'm over the control). Appreciate any and all help.

    Read the article

  • Array length is zero in jQuery.

    - by James123
    I wrote like this. After submit click loop is not excuting. But I saw value are there, But array lenght is showing '0'. (Please see picture). Why it is not going into loop? and $('#myVisibleRows').val(idsString); becoming 'empty'. $(document).ready(function() { $('tr[@class^=RegText]').hide().children('td'); var list_Visible_Ids = []; var idsString, idsArray; alert($('#myVisibleRows').val()); idsString = $('#myVisibleRows').val(); idsArray = idsString.split(','); $.each(idsArray, function() { if (this != "") { $('#' + this).siblings(('.RegText').toggle(true)); window['list_Visible_Ids'][this] = 1; } }); $('tr.subCategory1') .css("cursor", "pointer") .attr("title", "Click to expand/collapse") .click(function() { //this = $(this); $(this).siblings('.RegText').toggle(); list_Visible_Ids[$(this).attr('id')] = $(this).css('display') != 'none' ? 1 : null; alert(list_Visible_Ids[$(this).attr('id')]) }); $('#form1').submit(function() { idsString = ''; $.each(list_Visible_Ids, function(key, val) { alert(val); if (val) { idsString += (idsString != '' ? ',' : '') + key; } }); $('#myVisibleRows').val(idsString); form.submit(); }); });

    Read the article

  • What's the most efficient way to combine two List(Of String)?

    - by Jason Towne
    Let's say I've got: Dim los1 as New List(Of String) los1.Add("Some value") Dim los2 as New List(Of String) los2.Add("More values") What would be the most efficient way to combine the two into a single List(Of String)? Edit: While I'm loving the solutions everyone has provided so far, I probably should also mention I'm stuck using the .NET 2.0 framework. Any other suggestions?

    Read the article

  • Specifying a DLL reference

    - by Jesse
    I'm having trouble setting the path to a DLL that is not in the same directory as the executable. I have a reference to dllA.dll. At present, everything is just copied into the same directory and all is well; however, I need to move the executable to another directory while still referencing the DLL in the original directory. So, it's setup like: C:\Original\Dir program.exe dllA.dll dllB.dll dllC.dll But I need to have it setup like: C:\New\Dir program.exe dllB.dll dllC.dl Such that it is still able to reference dllA.dll in C:\Original\dir I tried the following, but to no avail: Set the "Copy Local" value to false for dllA.dll because I want it to be referenced in its original location. Under "Tools Options Projects and Solutions VC++ Directories" I have added the path to "C:\Original\Dir" Added "C:\Original\Dir" to both the PATH and LIB environment variables At runtime, it informs me that it cannot locate dllA.dll Maybe the above steps I took only matter at compile time? I was able to find this http://stackoverflow.com/questions/1382704/c-specifying-a-location-for-dll-reference But I was thinking that my above method should've worked. Any ideas?

    Read the article

  • Getting Build Errors in Program to Change Button Name When Clicked

    - by Rishabh
    Imports System Imports System.Windows.Forms Class MyButtonClass Inherits Form Private mrButton As Button Public Sub MyButtonClass() mrButton = New Button() mrButton.Text = "Click me " mrButton.Click += New System.EventHandler(MyButtonClickEventHandler) Me.Controls.Add(mrButton) End Sub Shared Sub Main() Application.Run(New MyButtonClass()) End Sub Private Sub MyButtonClickEventHandler(ByVal sender As Object, ByVal e As EventArgs) mrButton.Text = "You clicked me!" End Sub End Class

    Read the article

  • C# InternalsVisibleTo() attribute for VBNET 2.0 while testing?

    - by Will Marcouiller
    I'm building an Active Directory wrapper in VBNET 2.0 (can't use later .NET) in which I have the following: IUtilisateur IGroupe IUniteOrganisation These interfaces are implemented in internal classes (Friend in VBNET), so that I want to implement a façade in order to instiate each of the interfaces with their internal classes. This will allow the architecture a better flexibility, etc. Now, I want to test these classes (Utilisateur, Groupe, UniteOrganisation) in a different project within the same solution. However, these classes are internal. I would like to be able to instantiate them without going through my façade, but only for these tests, nothing more. Here's a piece of code to illustrate it: public static class DirectoryFacade { public static IGroupe CreerGroupe() { return new Groupe(); } } // Then in code, I would write something alike: public partial class MainForm : Form { public MainForm() { IGroupe g = DirectoryFacade.CreerGroupe(); // Doing stuff with instance here... } } // My sample interface: public interface IGroupe { string Domaine { get; set; } IList<IUtilisateur> Membres { get; } } internal class Groupe : IGroupe { private IList<IUtilisateur> _membres; internal Groupe() { _membres = new List<IUtilisateur>(); } public string Domaine { get; set; } public IList<IUtilisateur> Membres { get { return _membres; } } } I heard of InternalsVisibleTo() attribute, recently. I was wondering whether it is available in VBNET 2.0/VS2005 so that I could access the assmebly's internal classes for my tests? Otherwise, how could I achieve this?

    Read the article

  • VS 2010 SQL Update for SQL Statement

    - by Mike Tucker
    Please bear with me as I'm just beginning to learn this stuff. I have a VS 2010 Web project up and I'm trying to understand how I can make a custom UpdateCommand (Because I chose to write my own SQL statement, I do not have the option for VS 2010 to auto generate an update command for me.) Problem is: I don't know what the UpdateCommand should look like. Here is my Select: SELECT * FROM Dbo.MainAsset, dbo.Model, dbo.Hardware WHERE MainAsset.device = Hardware.DeviceID AND MainAsset.model = Model.DeviceID Which, VS 2010 turns into: SELECT MainAsset.pk, MainAsset.img, MainAsset.device, MainAsset.model, MainAsset.os, MainAsset.asset, MainAsset.serial, MainAsset.inyear, MainAsset.expyear, MainAsset.site, MainAsset.room, MainAsset.teacher, MainAsset.FirstName, MainAsset.LastName, MainAsset.Notes, MainAsset.Dept, MainAsset.AccountingCode, Model.Model AS Hardware, Model.pk AS Model, Model.DeviceID, Hardware.Computer, Hardware.pk AS Expr3, Hardware.DeviceID AS Expr4 FROM MainAsset INNER JOIN Hardware ON MainAsset.device = Hardware.DeviceID INNER JOIN Model ON MainAsset.model = Model.DeviceID How would I approach updating one column, say "MainAsset.site" if that's changed in the Gridview DDL? Any help constructive help would be appreciated. Thank you.

    Read the article

  • How to bring Webserive text into a Winform aplication

    - by CogentP
    I am working a Winform Application that needs to access a webservice to get some basic information. The webservice exists, and the following is a link that brings text. Which basically is the customer name in Json format. http://globalbox.com.py/api/getUSER.php?gb=3217 So, my point, i need to be able to read the name of the customer and put that into a string variable. How do I read this from Winforms? I have no idea how to go about doing this... please help. Visual Basic code would be better, or else C# will do. thanks in advance!!

    Read the article

  • Is MSDN referencing a system.thread, a worker thread, an io thread or all three?

    - by w0051977
    Please see the warning below taken from the StreamWriter class specification (http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx): "Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe." I understand that a W3WC process contains two thread pools i.e. worker threads and I/O threads. A worker thread could contain many threads of its own (if the application creates its own System.Thread instances). Does the warning only relate to System.Threads or does it relate to worker threads and I/O threads as well I.e. as the instance variables of the streamwriter class are not thread safe then does this mean that there would be problems if multiple worker threads access it eg if two users on two different web clients attempt to write to the log file at the same time, then could one lock out the other?

    Read the article

  • Moving the ScrollBar To the Selected Node In A TreeView Control

    - by Nick LaMarca
    I have a treeview control where I am dynamically selecting a node depending on user interaction. when a node is selected I want to be able to have the scrollbar go to the location of that selected node in the tree. The scrollbar is simply made by overflow:auto in the div tag where the treeview is located. Can someone give me some detailed code to accomplish this? Thanks in advance.

    Read the article

  • How to plot the graph(line) from a file in java?

    - by kiran
    I have a directory containing list of files. Those files have some list of values as x and y ordered as line by line. And my question is just I would like to read those files one by one and to plot line graphs based on those values. Could you please help me for that?

    Read the article

  • How do I run my application while a UAC dialog window is showing?

    - by Ray
    I have an application that I wrote in .NET. It needs to remain running and have access the desktop that the UAC dialog windows open on and interact with that desktop using keyboard and mouse events. It's sort of like a VNC program. Imagine you are running a VNC program and a UAC window pops up, you want your VNC program to still be able to control the desktop with the UAC window in it so that the user can move the mouse and click the OK button on the UAC dialog. Can anyone tell me how I would go about doing that? Thanks

    Read the article

< Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >