Search Results

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

Page 106/179 | < Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >

  • What are the different methods for injecting cross-cutting concerns?

    - by Stacy Vicknair
    What are the different methods for injecting cross-cutting concerns into a class so that I can minimize the coupling of the classes involved while keeping the code testable (TDD or otherwise)? For example, consider if I have a class that requires both logging functionality and centralized exception management. Should I use DIP and inject both required concerns via an interface into the class that requires them? Should I use a service locater that I pass to each class that will require some cross cutting functionality? Is there a different solution altogether? Am I asking the wrong question entirely?

    Read the article

  • Store code line in a string?

    - by user1342164
    I need to store code in a string so that if a value is true, it is in the code line if not true its not in the code line. When I populate summarytextbox if consulting amount is "" then dont use this code if is does have an amount include the code. Is this possible? Other wise I would have to do a bunch if then statements. When I do the following below it cant convert to double. Dim ConsultingFee As String Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Session("ConsultingFeeAmount") = "" Then Else 'Store the following line in a string???? ConsultingFee = +Environment.NewLine + Session("ConsultingFee") + " Amount: " + Session("ConsultingFeeAmount") End If SummaryTextBox.Text = Session("TeachingHospital") + Environment.NewLine + Session("HospitalAddress") + Environment.NewLine + Session("HospitalCity") + Environment.NewLine + Session("HospitalState") + Environment.NewLine + Session("HospitalZip") + Environment.NewLine + Session("HospitalTIN") + ConsultingFee End Sub

    Read the article

  • whatz wrong in this SELECt query of MSSQL... ?

    - by user522211
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim SQLData As New System.Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True") Dim cmdSelect As New System.Data.SqlClient.SqlCommand("SELECT * FROM Table1 WHERE Date =" & TextBox1.Text & "'", SQLData) SQLData.Open() Dim dtrReader As System.Data.SqlClient.SqlDataReader = cmdSelect.ExecuteReader() While dtrReader.Read() For j As Integer = 1 To 31 Dim s As String = "s" & j If dtrReader(s.ToString()).ToString() = "b" Then Dim img As ImageButton = DirectCast(Panel1.FindControl(s.ToString()), ImageButton) img.ImageUrl = "~/Images/booked.gif" img.Enabled = False End If Next End While dtrReader.Close() SQLData.Close() End Sub SHOWS AN ERROR : Unclosed quotation mark after the character string ''.

    Read the article

  • What is the difference between IEditableObject and IRevertibleChangeTracking?

    - by open-collar
    What is the difference between IEditableObject and IRevertibleChangeTracking (both from the System.ComponentModel namespace)? It looks as if the first supports explicit transaction whilst the second is more implicit - but the net result is the same. How should I go about implementing this in code? At the moment I do nothing in BeginEdit and call RejectChanges and AcceptChanges in EndEdit and CancelEdit respectively. My problem is that this will also accept the changes made prior to the BeginEdit. Is that really what MS wanted or am I trying to implement two mutually exclusive interfaces?

    Read the article

  • How to send data from an opened window back to its opener in WPF.

    - by TravisPUK
    In WPF I have one window opening a second window that allows some data selections to occur on. Once the selections have been made I then want to submit/close the second/sub window and have the data pushed back to the opening/parent window. I can push data into the sub window from the parent via public properties, but have not worked out how to get it back the other way. Can anyone help please? The code I am using to open the window and set some properties is has follows: Dim wdwContacts As New appContacts() wdwContacts.selClientID = selClientID wdwContacts.selEmailToCCType = selEmailToCCType wdwContacts.pullToAddresses = txEmailTo.Text wdwContacts.pullCCAddresses = txEmailCC.Text wdwContacts.Owner = Me wdwContacts.WindowStartupLocation = Windows.WindowStartupLocation.CenterOwner wdwContacts.Show() The basis is that I have the first window as an email composition page that has a button that when clicked brings up a list of email contacts. It brings through any previously selected email addresses from the first window and auto selects them on the sub window/email list. If further selections are made on the email list, when the op clicks the done/submit/close button it pushes the new selection list back into the relevant TextBox on the first/parent window. Thanks

    Read the article

  • Disable Drag&Drop of files in Richtextbox in .NET

    - by Jiri
    Hello, I use a .NET richtextbox and I want to have the EnableAutoDragDrop property set to True. This allows user to drag&drop text, rtf and images around etc. However, I need to process files dropped into the richtextbox myself - I do not want them to be embedded as OLE objects when they are dropped. How can I overcome this? Is there any way to delete embedded files from richtextbox? (I've found API DragAcceptFiles which doesn't work for some reason.) Thanks!

    Read the article

  • Creating Modules for VB Program (Similar to firefox add on)

    - by Assimilater
    Hi all. I have a contact manager program that I'd like to design for multiple network marketing companies. My desired structure would include a core program which covers basic contact management functions. After that one could purchase a module for their specific network marketing company. This module would contain a variety of controls that the original program would need to be able to manipulate. Here is an example of what it would have to have: A group box containing buttons that link to a genealogy view, and the option to import one's donwnline from the back office provided by a company. A panel which is displayed on the contact page allowing the user to input business information or which will be filled by importing a downline from the back office: ie business ID, qualification level, sponsor information etc. a panel displayed when one searches for contacts on the contact list page which allows the user to sort based on information such as when they joined, what their business id is and so forth. a panel which is displayed in a personal business overview page which presents to an individual how many people in their downline are at each qualification level and develop a mailing list for individuals of a certain qualification level. I have the code developed to perform all these functions, I just wanted to give you an example of what needed to be done. I'm thinking that what I'm trying to create is a library that one can download and the program will recognize, but I'm not really sure where to go. What I'm really trying to do is figure out what kind of file I can make that will contain all this code and the GUI information that the program will recognize. Any ideas? With thanks, John

    Read the article

  • Intercepting mouse events using a global hook. Stop an action from happening.

    - by fMinkel
    I'm attempting to intercept and interrupt mouse events. Lets say I wanted to disable the right mouse button down event, or even the mouse move event. I haven't been able to figure out the interrupting part. I am using the (I assume pretty widely used) following code for Global Hooking of the mouse. Private Structure MSLLHOOKSTRUCT Public pt As Point Public mouseData As Int32 Public flags As Int32 Public time As Int32 Public extra As IntPtr End Structure Private _mouseHook As IntPtr Private Const WH_MOUSE_LL As Int32 = 14 Private Delegate Function MouseHookDelegate(ByVal nCode As Int32, ByVal wParam As IntPtr, ByRef lParam As MSLLHOOKSTRUCT) As Int32 <MarshalAs(UnmanagedType.FunctionPtr)> Private _mouseProc As MouseHookDelegate Private Declare Function SetWindowsHookExW Lib "user32.dll" (ByVal idHook As Int32, ByVal HookProc As MouseHookDelegate, ByVal hInstance As IntPtr, ByVal wParam As Int32) As IntPtr Private Declare Function UnhookWindowsHookEx Lib "user32.dll" (ByVal hook As IntPtr) As Boolean Private Declare Function CallNextHookEx Lib "user32.dll" (ByVal idHook As Int32, ByVal nCode As Int32, ByVal wParam As IntPtr, ByRef lParam As MSLLHOOKSTRUCT) As Int32 Private Declare Function GetCurrentThreadId Lib "kernel32.dll" () As Integer Private Declare Function GetModuleHandleW Lib "kernel32.dll" (ByVal fakezero As IntPtr) As IntPtr Public Function HookMouse() As Boolean Debug.Print("Mouse Hooked") If _mouseHook = IntPtr.Zero Then _mouseProc = New MouseHookDelegate(AddressOf MouseHookProc) _mouseHook = SetWindowsHookExW(WH_MOUSE_LL, _mouseProc, GetModuleHandleW(IntPtr.Zero), 0) End If Return _mouseHook <> IntPtr.Zero End Function Public Sub UnHookMouse() Debug.Print("Mouse UnHooked") If _mouseHook = IntPtr.Zero Then Return UnhookWindowsHookEx(_mouseHook) _mouseHook = IntPtr.Zero End Sub Private Function MouseHookProc(ByVal nCode As Int32, ByVal wParam As IntPtr, ByRef lParam As MSLLHOOKSTRUCT) As Int32 'Debug.Print("Message = {0}, x={1}, y={2}", wParam.ToInt32, lParam.pt.X, lParam.pt.Y) If wParam.ToInt32 = 513 Then '''interrupt the left mouse button event here, but don't know what to return to do so. End If Return CallNextHookEx(WH_MOUSE_LL, nCode, wParam, lParam) End Function

    Read the article

  • How to refer to a text in an Ms Access table?

    - by manuel
    I want to refer to a data cell, which if it is equals to some string, it will do something. The codes: If ds.Tables(0).Rows(i)("Status") = "Reserved" Then MessageBox.Show("Can't reserve") End If Is this the correct way to do this? Because I failed doing so..

    Read the article

  • When are predicates appropriate and what is the best pattern for usage

    - by Maxim Gershkovich
    When are predicates appropriate and what is the best pattern for usage? What are the advantages of predicates? It seems to me like most cases where a predicate can be employed a tight loop would accomplish the same functionality? I don’t see a reusability argument given you will probably only implement a predicate in one method right? They look and feel nice but besides that they seem like you would only employ them when you need a quick hack on the collection classes? UPDATE But why would you be rewriting the tight loop again and again? In my mind/code when it comes to collections I always end up with something like Class Person End Class Class PersonList Inherits List(Of Person) Function FindByName(Name) as Person tight loop.... End Function End Class @Ani By that same logic I could implement the method as such Class PersonList Inherits List(Of Person) Function FindByName(Name) as PersonList End Function Function FindByAge(Age) as PersonList End Function Function FindBySocialSecurityNumber(SocialSecurityNumber) as PersonList End Function End Class And call it as such Dim res as PersonList = MyList.FindByName("Max").FindByAge(25).FindBySocialSecurityNumber(1234) and the result along with the amount of code and its reusability is largely the same, no? I am not arguing just trying to understand.

    Read the article

  • Give a number to return the approximated value of an Enum?

    - by ElektroStudios
    I have this enumeration: Enum Lame_Bitrate kbps_8 = 8 kbps_16 = 16 kbps_24 = 24 kbps_32 = 32 kbps_40 = 40 kbps_48 = 48 kbps_56 = 56 kbps_64 = 64 kbps_80 = 80 kbps_96 = 96 kbps_112 = 112 kbps_128 = 128 kbps_144 = 144 kbps_160 = 160 kbps_192 = 192 kbps_224 = 224 kbps_256 = 256 kbps_320 = 320 End Enum And I would like to return the approximated value of the Enum given a number. For example, if I have the number 190 then I expect to find the more approximated value in the Enum to return the 192 (kbps_192 value of the Enum), if I have the number 196 then again I expect to return the value 192 (not return the next value 224 because is less approximated). Something like this: Private Sub Test() Dim wma_file As String = "C:\windows media audio file.wma" Dim wma_file_Bitrate As Integer = 172 Dim mp3_bitrate_approximated As Integer mp3_bitrate_approximated = Return_Approximated_Value_Of_Enum(wma_file_Bitrate) End Sub private function Return_Approximated_Value_Of_Enum(byval value as integer) as integer return... enum.find(value).approximated... end function Exist any framework method to find the more approximated number given other number in a Enum? I hope you can understand my question, thank you. PS: I prefer a solution using LINQ extensions if can be.

    Read the article

  • Can I write a .NETCF Partial Class to extend System.Windows.Forms.UserControl?

    - by eidylon
    Okay... I'm writing a .NET CF (VBNET 2008 3.5 SP1) application, which has one master form, and it dynamically loads specific UserControls based on menu click, in a sort of framework idea. There are certain methods and properties these controls all need to work within the app. Right now I am doing this as an Interface, but this is aggravating as all get up, because some of the methods are optional, and yet I MUST implement them by the nature of interfaces. I would prefer to use inheritance, so that I can have certain code be inherited with overridability, but if I write a class which inherits System.Windows.Forms.UserControl and then inherit my control from that, it squiggles, and tells me that UserControls MUST inherit directly from System.Windows.Forms.UserControl. (Talk about a design flaw!) So next I thought, well, let me use a partial class to extend System.Windows.Forms.UserControl, but when I do that, even though it all seems to compile fine, none of my new properties/methods show up on my controls. Is there any way I can use partial classes to 'extend' System.Windows.Forms.UserControl? For example, can anyone give me a code sample of a partial class which simply adds a MyCount As Integer readonly property to the System.Windows.Forms.UserControl class? If I can just see how to get this going, I can take it from there and add the rest of my functionality. Thanks in advance! I've been searching google, but can't find anything that seems to work for UserControl extension on .NET CF. And the Interface method is driving me crazy as even a small change means updating ALL the controls whether they need to 'override' the method or not.

    Read the article

  • Is software testing has a future?

    - by Firas
    Hello every body. My current career is software testing, but I feel that iam wasting my time, may be because I dont know the future path of this carrer, and to where will I arrive in the future if I continue in this carrer. And I dont know how can I develop my self in this career. And can I have my own job in this field? Please give me good suggestions and openion. Many thanks

    Read the article

  • Items are being replace by another in the Datagridview

    - by stephanie
    When I add the first item in the datagridview its ok but when i add the second one it replace the last item being added. here's my code Private Sub add() Dim i As Integer For i = 0 To DataGridView1.Rows.Count - 1 'DataGridView1.Rows.Add() DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("TransID").Value = txttrans.Text DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("ProductCode").Value = txtprodcode.Text DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("ProductName").Value = cmbprodname.Text DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("Quantity").Value = txtqty.Text DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("Price").Value = txtprc.Text DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("Amount").Value = txtat.Text DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("CustomerName").Value = txtcust.Text DataGridView1.Rows(DataGridView1.RowCount - 1).Cells("Date1").Value = txtdate.Text Next i End Sub And this is in my ADDbutton: Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click Try add() Catch ex As Exception MessageBox.Show(ex.Message) End Try Dim total As Integer For Each row As DataGridViewRow In DataGridView1.Rows total += row.Cells("Amount").Value Next txtamt.Text = total

    Read the article

  • Deploy SMO application to workstation without SQL Server 2008 installed

    - by Matt
    I am trying to deploy an application that uses SMO on a workstation without SQL Server installed on it. The instance the app is connecting to is SQL Server 2008. The application is failing with: Could not load file or assembly 'Microsoft.SqlServer.Replication, Version 10.0.0.0, Culture=neutral, PublicKeyToken=89845cdc8080cc91' or one of its dependencies. An attempt was made to load a program with an incorrect format. The assembly in question is in the same path as my application as well as system32. I am running this on a Windows 7 64 bit box. I have run SQL Native Client, CLR, and SMO MSIs from the 2008 SMO redist download page. This app worked fine when connecting to SQL Server 2005. What gives?

    Read the article

  • I insert new parent row and child rowstate changes from Added to unchanged

    - by Joel
    rowsUpdated is an int32 to count how many rows are updated rowsToUpdate = dataset.ParentTable.Select("", "", dataviewRowState.Added) if rowsToUpdate isNot Nothing then for each row as datarow in RowsToUpdate changes the rowstate: rowsUpdated = rowsUpdated + ParentTableAdapter.update(row) Next row End if I'm sure it's something I'm over looking but I just can't see it. Thanks in advance, Joel

    Read the article

  • Are folks using the VB6 "Common Controls Replacement Project" controls? Any caveats or showstoppers?

    - by Clay Nichols
    I'm considering using the VB6 Common Controls Replacement Project controls and would like to see what other's experiences with them are. Specifically: What do you need to distribute with them? (I assume just the .OCX file) Do I need to register the .ocx file or just include in the app directory? Do these controls depend on any other ocx's? (There is mention, for example in the Progress Bar replacement that it is using COMCTL32.DLL but the .DEP file does not list that DLL. Are they at least as robust as the controls they replace?

    Read the article

  • How do you pass a generic delegate argument to a method in .NET 2.0

    - by Seth Spearman
    Hello, I have a class with a delegate declaration as follows... Public Class MyClass Public Delegate Function Getter(Of TResult)() As TResult 'the following code works. Public Shared Sub MyMethod(ByVal g As Getter(Of Boolean)) 'do stuff End Sub End Class However, I do not want to explicitly type the Getter delegate in the Method call. Why can I not declare the parameter as follows... ... (ByVal g As Getter(Of TResult)) Is there a way to do it? My end goal was to be able to set a delegate for property setters and getters in the called class. But my reading indicates you can't do that. So I put setter and getter methods in that class and then I want the calling class to set the delegate argument and then invoke. Is there a best practice for doing this. I realize in the above example that I can set set the delegate variable from the calling class...but I am trying to create a singleton with tight encapsulation. For the record, I can't use any of the new delegate types declared in .net35. Answers in C# are welcome. Any thoughts? Seth

    Read the article

< Previous Page | 102 103 104 105 106 107 108 109 110 111 112 113  | Next Page >