Search Results

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

Page 40/179 | < Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • Wpf vs WinForms for a vb programmer? [closed]

    - by Jeroen
    I am asked by a client to develop an application that is basically a screen on which the user can choose several items to pass the time (used in holding cells in mental hospitals for example). The baisc idea is as follows: TV (choosing this will provide the user with a number of TV streams from the interweb) Radio (...) Games (serveral flash games, also from the interweb) Music (play local music or streams) Draw something (not the game) Create an email Choose lighting settings for the room etc. etc. I am torn between WinForms and WPF for this project. It seems that WPF is the way to go since there is quite a bit of rich media involved but I have a 15 year VB background. The project obviously has a dead line and certain budget that I cannot cross and if I can avoid starting from scratch with some thing that will be nice. Is WPF worth it in this particular case or can I use WinForms with the incorperation of WPF controls? I would very much like to hear your thoughts/comments/suggestions!

    Read the article

  • OOP concept: is it possible to update the class of an instantiated object?

    - by Federico
    I am trying to write a simple program that should allow a user to save and display sets of heterogeneous, but somehow related data. For clarity sake, I will use a representative example of vehicles. The program flow is like this: The program creates a Garage object, which is basically a class that can contain a list of vehicles objects Then the users creates Vehicles objects, these Vehicles each have a property, lets say License Plate Nr. Once created, the Vehicle object get added to a list within the Garage object --Later on--, the user can specify that a given Vehicle object is in fact a Car object or a Truck object (thus giving access to some specific attributes such as Number of seats for the Car, or Cargo weight for the truck) At first sight, this might look like an OOP textbook question involving a base class and inheritance, but the problem is more subtle because at the object creation time (and until the user decides to give more info), the computer doesn't know the exact Vehicle type. Hence my question: how would you proceed to implement this program flow? Is OOP the way to go? Just to give an initial answer, here is what I've came up until now. There is only one Vehicle class and the various properties/values are handled by the main program (not the class) through a dictionary. However, I'm pretty sure that there must be a more elegant solution (I'm developing using VB.net): Public Class Garage Public GarageAdress As String Private _ListGarageVehicles As New List(Of Vehicles) Public Sub AddVehicle(Vehicle As Vehicles) _ListGarageVehicles.Add(Vehicle) End Sub End Class Public Class Vehicles Public LicensePlateNumber As String Public Enum VehicleTypes Generic = 0 Car = 1 Truck = 2 End Enum Public VehicleType As VehicleTypes Public DictVehicleProperties As New Dictionary(Of String, String) End Class NOTE that in the example above the public/private modifiers do not necessarily reflect the original code

    Read the article

  • About shared (static) Members and its behavior

    - by Allende
    I just realized that I can access shared members from instances of classes (probably this is not correct, but compile and run), and also learn/discover that, I can modify shared members, then create a new instance and access the new value of the shared member. My question is, what happens to the shared members, when it comes back to the "default" value (class declaration), how dangerous is it do this ? is it totally bad ? is it valid in some cases ?. If you want to test my point here is the code (console project vb.net) that I used to test shared members, as you can see/compile/run, the shared member "x" of the class "Hello" has default value string "Default", but at runtime it changes it, and after creating a new object of that class, this object has the new value of the shared member. Module Module1 Public Class hello Public Shared x As String = "Default" Public Sub New() End Sub End Class Sub Main() Console.WriteLine("hello.x=" & hello.x) Dim obj As New hello() Console.WriteLine("obj.x=" & obj.x) obj.x = "Default shared memeber, modified in object" Console.WriteLine("obj.x=" & obj.x) hello.x = "Defaul shared member, modified in class" Console.WriteLine("hello.x=" & hello.x) Dim obj2 As New hello() Console.WriteLine("obj2.x=" & obj2.x) Console.ReadLine() End Sub End Module UPDATE: First at all, thanks to everyone, each answer give feedback, I suppose, by respect I should choose one as "the answer", I don't want to be offensive to anyone, so please don't take it so bad if I didn't choose you answer.

    Read the article

  • How would you TDD the functionality of getting the corresponding process of a running windows service?

    - by Matt Spinelli
    Purpose Over the last year or more I've been learning unit testing via books I've read recently like The Art of Unit Testing, Working Effectively with Legacy Code, and others. I've also been using unit tests, mocking frameworks, and the like, periodically at work and definitely see the value. However, I'm still having a hard time wrapping my mind around TDD (as opposed to TAD) when the situation calls for code that is gong to mostly use external API calls. Problem to solve Get the process associated with a windows service using the service name. example: Function GetProcess(ByVal serviceName As String) As Process Rules Show each major iteration in production & test code using TDD No need to see any other code or configuration that is required to get things to run. Just curious about the interfaces, concrete classes, and test methods. C# or VB.NET Must use the .Net framework regarding services/processes (i.e. System.Diagnostics.Process) Test Frameworks: Nunit or MSTest Isolation Frameworks: Moq, Rhino Mock, or Microsoft Moles Must write true unit tests (no integration tests) Additional notes As far as I can tell there are two approaches design wise. Use an Inversion of Control approach along with using the Adapter and/or Facade patterns to wrap the underlying .net framework objects dealing with processes and services. Keep the .net framework code in the class containing the Get Process method and use code detouring (interception) via Microsoft Moles to isolate the hard dependencies from the method under test.

    Read the article

  • MVC 3: ActionLink VB.Net

    - by xamlnotes
    Theres not a ton of good samples out there on using MVC with VB, so I am going to post some things that I am doing on a project. Lets look at links. I am converting a asp classic app to mvc.  One page has an anchor tag which I modified to look like so to point to a controller action: <A style=color:red; HREF='Detail/" & currentItem.IdNumber & "'>" & currentItem.IdNumber & "</A> This resolves out to what looks like the right URL and in fact the detail action is fired. The actions signature looks like so: Function Detail(ByVal IdNumber As String) As ActionResult But, IdNumber would always be blank, it was never set to the id passed in the url.  Hmm. So, I tried the following by using the ActionLink method of the html helper: Html.ActionLink(currentLead.LeadNumber, "Detail", New With {.IdNumber = currentItem.IdNumber })  Viola! That worked fine and the Detail method parameter was set just like it should be. Very interesting.

    Read the article

  • Best Language for the job? Database | C++, .NET, Java

    - by Randy E
    Ok, quick overview. I'm pretty brand new to software design. I have experience reading and editing/customizing PHP things for online scripts/software; Such as CMS, Wordpress, some forum solutions. I'm about to begin my degree in Software Design, the school I'm going to will allow us to kind of focus on an area, C++, Java, or .NET. I've played around a little with VB over the past week, mostly just trying to get a slight feel for it, however nothing extensive. I've been through Herbert Schildt's "C++, A Beginner's Guide." but I was mainly reading it, not doing anything with it beyond a couple basic Console Apps (and getting frustrated with auto-close :/ ). Now, where I decide to focus more in with my degree will depend on what the best language for the job is for my first piece of software I want to develop on my own. Assume I haven't looked at any of the languages at all, please help with the following: My first piece of software will be a database program. Everything has to do with users inputting and retrieving data, and calling that data to help with another function of the software, automatically calculating billing information based on information inputted in the other portion of the program. I won't go into too many details as I'm targeting a niche that doesn't have too much competition, but the competition that is there is established. I want to offer more features, scalable solutions, and the ability to port it to an online version. Ok, basically, it is a complete case management with integrated billing for Private Investigators. I would like the case management to be able to check the Database to see if certain information has been inputted before (such as Names/SSN's), and then the billing will pull hours inputted in the case portion for investigative work, multiplying by an already inputted amount for the fee, and then calculate sales tax. I also want to provide potential clients with an easily scalable solution, that is, a basic option for start ups that costs the least amount, with no additional users, ran on one machine. A middle option with the ability to create users and place them in two groups (User or Admin), as well as adding a few additional features, ran on one machine, but this will allow it to be accessed after being mapped on a network drive. And a third option to allow the placement into 4 different groups (Investigators, Billing, Managers, Admins) and more features. And then, a couple of years after launch, a 4th option that is browser based allowing the same 4 groups to login, as well as clients (view things concerning their case, with some admin customizable objects that can be added for clients view), over the internet. The only licensing security I would like to employ right off the bat will be serial key generated after ordering online (received in an email after the successful purchase). The program will access a database stored on a server periodically to verify license. I would like it to be able to check to make sure it's the most updated version and automatically update if not.

    Read the article

  • Distribute EXE without config file (Webservice in WinForm)

    - by Marc vB
    I have created a WinForm app (VB.NET 2008) that references to a webservice which was added via "Add Service Reference". The app works ok. Question is about distribution of the app. It looks like I need to install the app's config file with the EXE, however I don't want that because the config files shows the actual url of the web service which is not whatt I want. So, is it possible to use a webservice in a WinForm app and only have to install the resulting EXE?

    Read the article

  • How to print PCL Directly to the printer? Vb.net VS 2010

    - by Justin
    Good day, I've been trying to upgrade an old Print Program that prints raw pcl directly to the printer. The print program takes a PCL Mask and a PCL Batch Spool File (just pcl with page turn commands, I think) merges them and sends them off to the printer. I'm able to send to the Printer a file stream of PCL but I get mixed results and i do not understand why printing is so difficult under .net. I mean yes there is the PrintDocument class, but to print PCL... Let's just say I'm ready to detach my printer from the network and burn it a live. Here is my class PrintDirect (rather a hybrid class) Imports System Imports System.Text Imports System.Runtime.InteropServices <StructLayout(LayoutKind.Sequential)> _ Public Structure DOCINFO <MarshalAs(UnmanagedType.LPWStr)> _ Public pDocName As String <MarshalAs(UnmanagedType.LPWStr)> _ Public pOutputFile As String <MarshalAs(UnmanagedType.LPWStr)> _ Public pDataType As String End Structure 'DOCINFO Public Class PrintDirect <DllImport("winspool.drv", CharSet:=CharSet.Unicode, ExactSpelling:=False, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function OpenPrinter(ByVal pPrinterName As String, ByRef phPrinter As IntPtr, ByVal pDefault As Integer) As Long End Function <DllImport("winspool.drv", CharSet:=CharSet.Unicode, ExactSpelling:=False, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function StartDocPrinter(ByVal hPrinter As IntPtr, ByVal Level As Integer, ByRef pDocInfo As DOCINFO) As Long End Function <DllImport("winspool.drv", CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function StartPagePrinter(ByVal hPrinter As IntPtr) As Long End Function <DllImport("winspool.drv", CharSet:=CharSet.Ansi, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function WritePrinter(ByVal hPrinter As IntPtr, ByVal data As String, ByVal buf As Integer, ByRef pcWritten As Integer) As Long End Function <DllImport("winspool.drv", CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function EndPagePrinter(ByVal hPrinter As IntPtr) As Long End Function <DllImport("winspool.drv", CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function EndDocPrinter(ByVal hPrinter As IntPtr) As Long End Function <DllImport("winspool.drv", CharSet:=CharSet.Unicode, ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function ClosePrinter(ByVal hPrinter As IntPtr) As Long End Function 'Helps uses to work with the printer Public Class PrintJob ''' <summary> ''' The address of the printer to print to. ''' </summary> ''' <remarks></remarks> Public PrinterName As String = "" Dim lhPrinter As New System.IntPtr() ''' <summary> ''' The object deriving from the Win32 API, Winspool.drv. ''' Use this object to overide the settings defined in the PrintJob Class. ''' </summary> ''' <remarks>Only use this when absolutly nessacary.</remarks> Public OverideDocInfo As New DOCINFO() ''' <summary> ''' The PCL Control Character or the ascii escape character. \x1b ''' </summary> ''' <remarks>ChrW(27)</remarks> Public Const PCL_Control_Character As Char = ChrW(27) ''' <summary> ''' Opens a connection to a printer, if false the connection could not be established. ''' </summary> ''' <returns></returns> ''' <remarks></remarks> Public Function OpenPrint() As Boolean Dim rtn_val As Boolean = False PrintDirect.OpenPrinter(PrinterName, lhPrinter, 0) If Not lhPrinter = 0 Then rtn_val = True End If Return rtn_val End Function ''' <summary> ''' The name of the Print Document. ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property DocumentName As String Get Return OverideDocInfo.pDocName End Get Set(ByVal value As String) OverideDocInfo.pDocName = value End Set End Property ''' <summary> ''' The type of Data that will be sent to the printer. ''' </summary> ''' <value>Send the print data type, usually "RAW" or "LPR". To overide use the OverideDocInfo Object</value> ''' <returns>The DataType as it was provided, if it is not part of the enumeration it is set to "UNKNOWN".</returns> ''' <remarks></remarks> Public Property DocumentDataType As PrintDataType Get Select Case OverideDocInfo.pDataType.ToUpper Case "RAW" Return PrintDataType.RAW Case "LPR" Return PrintDataType.LPR Case Else Return PrintDataType.UNKOWN End Select End Get Set(ByVal value As PrintDataType) OverideDocInfo.pDataType = [Enum].GetName(GetType(PrintDataType), value) End Set End Property Public Property DocumentOutputFile As String Get Return OverideDocInfo.pOutputFile End Get Set(ByVal value As String) OverideDocInfo.pOutputFile = value End Set End Property Enum PrintDataType UNKOWN = 0 RAW = 1 LPR = 2 End Enum ''' <summary> ''' Initializes the printing matrix ''' </summary> ''' <param name="PrintLevel">I have no idea what the hack this is...</param> ''' <remarks></remarks> Public Sub OpenDocument(Optional ByVal PrintLevel As Integer = 1) PrintDirect.StartDocPrinter(lhPrinter, PrintLevel, OverideDocInfo) End Sub ''' <summary> ''' Starts the next page. ''' </summary> ''' <remarks></remarks> Public Sub StartPage() PrintDirect.StartPagePrinter(lhPrinter) End Sub ''' <summary> ''' Writes a string to the printer, can be used to write out a section of the document at a time. ''' </summary> ''' <param name="data">The String to Send out to the Printer.</param> ''' <returns>The pcWritten as an integer, 0 may mean the writter did not write out anything.</returns> ''' <remarks>Warning the buffer is automatically created by the lenegth of the string.</remarks> Public Function WriteToPrinter(ByVal data As String) As Integer Dim pcWritten As Integer = 0 PrintDirect.WritePrinter(lhPrinter, data, data.Length - 1, pcWritten) Return pcWritten End Function Public Sub EndPage() PrintDirect.EndPagePrinter(lhPrinter) End Sub Public Sub CloseDocument() PrintDirect.EndDocPrinter(lhPrinter) End Sub Public Sub ClosePrint() PrintDirect.ClosePrinter(lhPrinter) End Sub ''' <summary> ''' Opens a connection to a printer and starts a new document. ''' </summary> ''' <returns>If false the connection could not be established. </returns> ''' <remarks></remarks> Public Function Open() As Boolean Dim rtn_val As Boolean = False rtn_val = OpenPrint() If rtn_val Then OpenDocument() End If Return rtn_val End Function ''' <summary> ''' Closes the document and closes the connection to the printer. ''' </summary> ''' <remarks></remarks> Public Sub Close() CloseDocument() ClosePrint() End Sub End Class End Class 'PrintDirect Here is how I print my file. I'm simple printing the PCL Masks, to show proof of concept. But I can't even do that. I can effectively create PCL and send it the printer without reading the file and it works fine... Plus I get mixed results with different stream reader text encoding as well. Dim pJob As New PrintDirect.PrintJob pJob.DocumentName = " test doc" pJob.DocumentDataType = PrintDirect.PrintJob.PrintDataType.RAW pJob.PrinterName = sPrinter.GetDevicePath '//This is where you'd stick your device name, sPrinter stands for Selected Printer from a dropdown (combobox). 'pJob.DocumentOutputFile = "C:\temp\test-spool.txt" If Not pJob.OpenPrint() Then MsgBox("Unable to connect to " & pJob.PrinterName, MsgBoxStyle.OkOnly, "Print Error") Exit Sub End If pJob.OpenDocument() pJob.StartPage() Dim sr As New IO.StreamReader(Me.txtFile.Text, Text.Encoding.ASCII) '//I've got best results with ASCII before, but only mized. Dim line As String = sr.ReadLine 'Fix for fly code on first run 'If line = 27 Then line = PrintDirect.PrintJob.PCL_Control_Character Do While (Not line Is Nothing) pJob.WriteToPrinter(line) line = sr.ReadLine Loop 'pJob.WriteToPrinter(ControlChars.FormFeed) pJob.EndPage() pJob.CloseDocument() sr.Close() sr.Dispose() sr = Nothing pJob.Close() I was able to get to print the mask, in the morning... now I'm getting strange printer characters scattered through 5 pages... I'm totally clueless. I must have changed something or the printer is at fault. You can access my test Check Mask, here http://kscserver.com/so/chk_mask.zip .

    Read the article

  • VB.NET: How to know time for which system is idle?

    - by Daredev
    I'm making an application in which I'm implementing auto-monitor turn off when system is idle, i.e. when user is not interacting with the system. I found a link: http://www.codeproject.com/KB/system/SystemIdleTimerComponent.aspx it does provides the componenent to know when system is idle. But when I include: Public WM_SYSCOMMAND As Integer = &H112 Public SC_MONITORPOWER As Integer = &Hf170 <DllImport("user32.dll")> _ Private Shared Function SendMessage(hWnd As Integer, hMsg As Integer, wParam As Integer, lParam As Integer) As Integer End Function Private Sub button1_Click(sender As Object, e As System.EventArgs) SendMessage(Me.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, 2) End Sub It shows this error: Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on.

    Read the article

  • how to assign datasource progamitically in XtraReports/Vb.net ???

    - by ahmed
    hello, we recently got DevExpress components, and now we are working on XtraReports. I would like to know how do I manually code data source and datatable and the most important how to assign the data source to the labels on the report ? Please any help will be appreciated. Thanking you all in advance for your time and consideration.

    Read the article

  • Strange WndProc bug in .Net. VB.Net more specifically.

    - by Jules
    ETA: I use visual studio 2008 express edition. If I override WndProc and mess up somehow, I'll usually backtrack by commenting out code until it works again. The strange thing with WndProc though is you can strip it down to: Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) MyBase.WndProc((m)) End Sub and it still throws the error. I have to remove the code and retype it in to reset the error. Anyone else experienced this?

    Read the article

  • (VB.NET + WPF) Drag + Drop (to allow user sorting) of stackpanel elements within a Scrollviewer?

    - by Matt H.
    I have good model (I think!) for how to allow a user to drag an element in a stackpanel and reposition it to another location within the stackpanel. However, my Stackpanel is placed within a ScrollViewer, like this (generalized): <ScrollViewer> <StackPanel> ....First item ....Second item ....Third item ....Etc. </StackPanel> <ScrollViewer> Here is the problem, I wish to simulate the functionality of programs like word, where if I am dragging selected content (or an object) outside the viewable area, the window will scroll in the direction of the mouse to see more places to drop my nifty little object. ...i.e. If I move the mouse to the top of my ScrollViewer while dragging a stackpanel's contents, I want the scrollviewer to slowly move up so I can see more locations to drop my content. Any suggestions? If you can help me solve this, you will be a godsend!

    Read the article

  • VB.Net how to wait for a different form to close before continuing on.

    - by Sean P
    I have a little log in screen that pops up if a user selects a certain item on my main form. How do I get my code to stop executing til my log in form closes? This is what I am doing so far. Basically i want o execute the code after MyLogin closes. BMSSplash.MyLogin.Show() If isLoggedIn Then BMSSplash.MyBuddy.Show() Cursor.Current = Cursors.WaitCursor End If

    Read the article

  • How to set an array to a list of values in VB.NET?

    - by IPX Ares
    I cannot figure out how to set an array to one of two sets of numbers (there will be more later), every way that I have tried throws some kind of error. I have tried to Dim the array inside the case statements, but then I cannot use the array in the For Each, which makes this worthless.... any ideas would be appreciated. Code: Dim HourArray() As Integer Select Case CurrentShapeRow(ROW_PERIOD) Case "ON", "2X16" HourArray = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21} Case "2X8", "5X8" HourArray = {0, 1, 2, 3, 4, 5, 22, 23} Case Else Throw New Exception(String.Format("Unhandled Period: {0}", CurrentShapeRow(ROW_PERIOD))) End Select For Each HourCount As Integer In HourArray() 'DO SOME STUFF HERE Next

    Read the article

  • How to make a web browser with tabbed browsing with vb 2008?

    - by felixd68
    I've tried multiple times to create a web browser with tabbed browsing. I know that I have to use "tab control". I have succeeded in creating a semi-tabbed browsing. People are able to add new tabs, but the webbrowser component only appears in one tab page. Coding: Form1_Load: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Browse As New WebBrowser TabControl1.TabPages.Add(1, "TabPage" & i) TabControl1.SelectTab(1 - 1) Browse.Name = "wb" Browse.Dock = DockStyle.Fill TabControl1.SelectedTab.Controls.Add(Browse) i = i + 1 End Sub Web Browser Component Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) url.Text = e.Url.ToString() 'your url text box will show the actual url of the page after the page is fully loaded url.Text = e.Url.ToString Me.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle & " - Webbrowser's name" TabControl1.SelectedTab.Text = CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle End Sub

    Read the article

  • Why would the VB.NET compiler think an interface isn't implemented when it is?

    - by Dan Tao
    I have this happen sometimes, particularly with the INotifyPropertyChanged interface in my experience but I have no idea if the problem is limited to that single interface (which would seem bizarre) or not. Let's say I have some code set up like this. There's an interface with a single event. A class implements that interface. It includes the event. Public Interface INotifyPropertyChanged Event PropertyChanged As PropertyChangedEventHandler End Interface Public Class Person Implements INotifyPropertyChanged Public Event PropertyChanged _ (ByVal sender As Object, ByVal e As PropertyChangedEventArgs) _ Implements INotifyPropertyChanged.PropertyChanged ' more code below ' End Class Every now and then, when I build my project, the compiler will suddenly start acting like the above code is broken. It will report that the Person class does not implement INotifyPropertyChanged because it doesn't have a PropertyChanged event; or it will say the PropertyChanged event can't implement INotifyPropertyChanged.PropertyChanged because their signatures don't match. This is weird enough as it is, but here's the weirdest part: if I just cut out the line starting with Event PropertyChanged and then paste it back in, the error goes away. The project builds. Does anybody have any clue what could be going on here?

    Read the article

  • ASP.NET/Vb.net: How to create a frame after an image is uploaded ?

    - by stighy
    Hi guys, i would like to create a fixed size frame for user photos uploaded. I've tought: i, can create a fixed sized image (200 width x 600 height for example), with my personal frame (top, left, bottom, right element graphics) , and in the center a transparency. Ok, but i don't know how to merge the photo into the frame and save the new photo format. Does anybody have some piece of code to help me ? Thank you!

    Read the article

  • Can I someone point to me what I did wrong? Trying to map VB to Java using JNA to access the library

    - by henry
    Original Working VB_Code Private Declare Function ConnectReader Lib "rfidhid.dll" () As Integer Private Declare Function DisconnectReader Lib "rfidhid.dll" () As Integer Private Declare Function SetAntenna Lib "rfidhid.dll" (ByVal mode As Integer) As Integer Private Declare Function Inventory Lib "rfidhid.dll" (ByRef tagdata As Byte, ByVal mode As Integer, ByRef taglen As Integer) As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim desc As String desc = "1. Click ""Connect"" to talk to reader." & vbCr & vbCr desc &= "2. Click ""RF On"" to wake up the TAG." & vbCr & vbCr desc &= "3. Click ""Read Tag"" to get tag PCEPC." lblDesc.Text = desc End Sub Private Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click If cmdConnect.Text = "Connect" Then If ConnectReader() Then cmdConnect.Text = "Disconnect" Else MsgBox("Unable to connect to RFID Reader. Please check reader connection.") End If Else If DisconnectReader() Then cmdConnect.Text = "Connect" End If End If End Sub Private Sub cmdRF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRF.Click If cmdRF.Text = "RF On" Then If SetAntenna(&HFF) Then cmdRF.Text = "RF Off" End If Else If SetAntenna(&H0) Then cmdRF.Text = "RF On" End If End If End Sub Private Sub cmdReadTag_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdReadTag.Click Dim tagdata(64) As Byte Dim taglen As Integer, cnt As Integer Dim pcepc As String pcepc = "" If Inventory(tagdata(0), 1, taglen) Then For cnt = 0 To taglen - 1 pcepc &= tagdata(cnt).ToString("X2") Next txtPCEPC.Text = pcepc Else txtPCEPC.Text = "ReadError" End If End Sub Java Code (Simplified) import com.sun.jna.Library; import com.sun.jna.Native; public class HelloWorld { public interface MyLibrary extends Library { public int ConnectReader(); public int SetAntenna (int mode); public int Inventory (byte tagdata, int mode, int taglen); } public static void main(String[] args) { MyLibrary lib = (MyLibrary) Native.loadLibrary("rfidhid", MyLibrary.class); System.out.println(lib.ConnectReader()); System.out.println(lib.SetAntenna(255)); byte[] tagdata = new byte[64]; int taglen = 0; int cnt; String pcepc; pcepc = ""; if (lib.Inventory(tagdata[0], 1, taglen) == 1) { for (cnt = 0; cnt < taglen; cnt++) pcepc += String.valueOf(tagdata[cnt]); } } } The error happens when lib.Inventory is run. lib.Inventory is used to get the tag from the RFID reader. If there is no tag, no error. The error code An unexpected error has been detected by Java Runtime Environment: EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0b1d41ab, pid=5744, tid=4584 Java VM: Java HotSpot(TM) Client VM (11.2-b01 mixed mode windows-x86) Problematic frame: C [rfidhid.dll+0x141ab] An error report file with more information is saved as: C:\eclipse\workspace\FelmiReader\hs_err_pid5744.log

    Read the article

  • VB in Access: Combo Box Values are not visible in form view but are visible through Debug.Print

    - by Thor
    Code in Form onLoad: country_combo.RowSourceType = "Value List" Code in a reset function: Dim lListIndex As Long With Me.country_combo For lListIndex = .ListCount - 1 To 0 Step -1 .RemoveItem (lListIndex) Next lListIndex<br/> End With Code to populate country combo: *For n = 1 To numCountries* *countryCombo.AddItem (countryRS.Fields("countryName"))* *countryRS.MoveNext* *Next n* I'm having a problem that occurs AFTER the code to populate the country combobox runs. The values are there as I can run Debug.Print(countryCombo.Value) and it prints out the name of the selected country, but I can't see the values in the combobox at all. They're invisible, and as far as I know there is no visiblity property for specific items, unless I'm completely mistaken.

    Read the article

  • VB .Net - Reflection: Reflected Method from a loaded Assembly executes before calling method. Why?

    - by pu.griffin
    When I am loading an Assembly dynamically, then calling a method from it, I appear to be getting the method from Assembly executing before the code in the method that is calling it. It does not appear to be executing in a Serial manner as I would expect. Can anyone shine some light on why this might be happening. Below is some code to illustrate what I am seeing, the code from the some.dll assembly calls a method named PerformLookup. For testing I put a similar MessageBox type output with "PerformLookup Time: " as the text. What I end up seeing is: First: "PerformLookup Time: 40:842" Second: "initIndex Time: 45:873" Imports System Imports System.Data Imports System.IO Imports Microsoft.VisualBasic.Strings Imports System.Reflection Public Class Class1 Public Function initIndex(indexTable as System.Collections.Hashtable) As System.Data.DataSet Dim writeCode As String MessageBox.Show("initIndex Time: " & Date.Now.Second.ToString() & ":" & Date.Now.Millisecond.ToString()) System.Threading.Thread.Sleep(5000) writeCode = RefreshList() End Function Public Function RefreshList() As String Dim asm As System.Reflection.Assembly Dim t As Type() Dim ty As Type Dim m As MethodInfo() Dim mm As MethodInfo Dim retString as String retString = "" Try asm = System.Reflection.Assembly.LoadFrom("C:\Program Files\some.dll") t = asm.GetTypes() ty = asm.GetType(t(28).FullName) 'known class location m = ty.GetMethods() mm = ty.GetMethod("PerformLookup") Dim o as Object o = Activator.CreateInstance(ty) Dim oo as Object() retString = mm.Invoke(o,Nothing).ToString() Catch Ex As Exception End Try return retString End Function End Class

    Read the article

< Previous Page | 36 37 38 39 40 41 42 43 44 45 46 47  | Next Page >