Jump to content
Xtreme .Net Talk

tommyf

Members
  • Posts

    21
  • Joined

  • Last visited

Everything posted by tommyf

  1. Hi I am using a dll to extract information from an epos terminal. This brings me back information about the buttons on the terminal. It brings me back an integer for the button color as a 256 color pallet number. How do I use this for the background color of my button on my form. Thanks in advance
  2. Hi Thank you for your help. I have managed to get this to work at last. The only problem i have is that it only callsback once and not everytime the till is used. I think it must be getting garbbaged collected. How do i stop this? The only other problem I have is that my call back so I have been told should bring back a 48 element char [byte] array. At the moment my call back is ByVal szJournalData() As Byte and convert this as follows str = System.Text.Encoding.ASCII.GetString(szJournalData, 0, szJournalData.Length) But it only brings back one character Thanks again
  3. Hi Thank you so very much for your help on this. It does not actualy highlight the row that is causing the error. When Private Sub ICRCOMMJobEJF() runs it runs fine with out error. It is only when I hit a button in the till that the error is thrown. my callback function looks as follows Public Sub CALLBACK_FUNCTION(ByRef szJournalData As Byte(), ByRef sFromECR As Integer) Stop 'Code to show reading from till End Sub Thanks again
  4. Hi I have managed to get a bit further with this. I have managed to pass in the function pointer but get the follwoing error Attempted to read or write protected memory. This is often an indication that other memory is corrupt. My code is as follows <DllImport("icrcomm.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _ Private Shared Sub ICR_COMMJob(ByVal TargetECR As Short, ByVal JobNo As Short, ByVal FileNumberList() As Short, ByVal FromRecord() As Short, ByVal ToRecord() As Short, ByVal TextData As mycallback) End Sub <UnmanagedFunctionPointer(CallingConvention.Cdecl)> _ Public Delegate Sub mycallback(ByRef szJournalData As Byte(), ByVal sFromECR As Integer) Private Sub ICRCOMMJobEJF() Dim ret As Short Dim FileList As Short() = New Short() {900, 0} Dim del As New mycallback(AddressOf CALLBACK_FUNCTION) ICR_COMMShow() ICR_COMMJob(101, 10, FileList, Nothing, Nothing, del) End Sub I presume I must be passing the function in wrong somehow. can somebody tell me how to pass in a callback from an unmanaged dll Thanks
  5. Hi Hope somebody can help me. I am using a 3rd part unmanaged C++ DLL to be able to drag information from an epos system. most of the information I can pull over fine. The problem I have is trying to get the live Electronic Journal information. When I memeber of staff sells something it should automatically post back the information. This is the documentation that comes with the DLL short ICR_COMMJob( short TargetECR, short JobNo, short * FileNumberList, short * FromRecord, short * ToRecord, char * TextData) Parameters short TargetECR-Terminal to communicate with. 0 will cause it to use the terminal number as specified in the .ini file 2000 will communicate will all terminals. Communications will go through the terminal number specified in the .ini file. short JobNo-Job number to run. Short * FileNumberList-NULL terminated array of file numbers to be processed with the job numbers. short * FromRecord-NULL terminated array of from record numbers to be processed on the above file numbers. Must be the same length as the file number array. Can be NULL, in which case all from records will be zero. short * ToRecord-NULL terminated array of to record numbers to be processed on the above file numbers Must be the same length as the file number array. Can be NULL, in which case all to records will be ALL RECORDS. char * TextData-NULL terminated string, Text data to be sent, used with text message, modem init, modem dial etc Job 10, Journal Broadcast; Calling ICR_COMM with job 10 initiates journal broadcast, The address of a function must be passed using the TextData parameter. This function is then called each time journal data is received by ICR_COMM. Function prototype passed to ICR_COMMJob, must be; void JournalLineReceived(char szJournalData[48], short sFromECR); char szJournalData[48] Will contain a NULL terminated string of the data received. short sFromECR The terminal number of the machine that the data is received from. Job 10 can be called multiple times for multiple ECRs. I am trying to run Job 10 as follows <DllImport("icrcomm.dll", CharSet:=CharSet.Ansi, SetLastError:=True)> _ Private Shared Function ICR_COMMJob(ByVal TargetECR As Short, ByVal JobNo As Short, ByVal FileNumberList() As Short, ByVal FromRecord() As Short, ByVal ToRecord() As Short, ByVal TextData As Object) As Short End Function Public Delegate Function ejPassdata(ByVal szJournalData As String, ByVal sFromECR As Char) Private mydelegate As New ejPassdata(AddressOf JournalLineReceived) Private Sub ICRCOMMJobEJF() Dim ret As Short Dim FileList As Short() = New Short() {900, 0} ICR_COMMShow() ICR_COMMJob(101, 10, FileList, Nothing, Nothing, mydelegate) End Sub Public Function JournalLineReceived(ByVal szJournalData As String, ByVal sFromECR As Char) Stop Me.TextBox1.Text = Me.TextBox1.Text & sFromECR Me.TextBox1.Text = Me.TextBox1.Text & szJournalData Me.TextBox1.Refresh() End Function So when I click a button it calls ICRCOMMJobEJF() and send the command to the workstation to start posting back data to a text box. When I run the ICRCOMMJobEJF() everything seems to work ok except when the till is used and it trys to send data back I get a VSHost has stopped working. I presume I presume my code is wrong and is not pointing back to the correct Function. Any help would be appriciated
  6. I have a combobox on a form and when the form loads the style is simple as I am just navigating through records. When I hit the add to add a new record I change the style to Dropdownlist which works fine so I can only select what is in the list. The problem comes when I want to edit a record, when I hit edit and the style changes to dropdownlist what information was there before disappears. If I change the style to dropdown the previous information stays but I can then type any information into the combox and not just select from the dropdown list.
  7. Thanksfor your help that works fine.
  8. I have the validating event on some of my text boxes on my windows form. When I press a search button my controls clear and some of them are enabled and some are not. The problem I have is that I can do a search on one or all of the textboxes but if I click in a textbox and then change my mind on what I want to search for the validating event kicks in and I can't get out of it until I entry something into it. Can I turn the validating event on and off when needed at run time
  9. thanks for the replies. It is a windows app
  10. This is going to be a very easy thing to do but I just cant seem to sort it. I have a form with peoples names and addrsses etc. I also have a datagrid which I would like to show information form another table. The tables are related as I can fill the datagrid with the parent table and I get the + sign which will show me the child fields But how do I just show the related child fileds?
  11. I have a combobox bound to a dataset using databinding. When the form loads it popultes the rest of the text boxes with the relevant information from the first record. What I can't seem to find out what to do is when I change the record in the combobox the rest of the text boxes change to. Do I have to use the position of the record as the key to all this.
  12. Hi The Machine is in a data center and I do have a admin login. Thanks for all your help on this matter.
  13. Thanks Liqdfire I am using win2K and as far as I am aware I can't give a remote FTP site a drive letter.
  14. Thanks for the reply Liqdfire This may sound like a silly question but I just cant figure it out. I have mapped the drive and it appears in my network neighbourhood but I cant seem to get it to see this drive
  15. Hi I can use filesystemwatcher on a local directory and I know I can use it on a remote directory but I am unable to find out how to do this. I basicaly want to be able to watch an FTP sight for file uplaods.
  16. tommyf

    Date Format

    Thanks mutant that works Why does it have to be MM?
  17. I have the following cade that takes the date from a calander control and then extracts the required field from a database. Dim fdate As Date Dim fday As Integer fday = fday - Weekday(Me.DateTimePicker1.Value.Date, 0) + 1 fdate = DateAdd("d", +fday, Me.DateTimePicker1.Value.Date) Dim mycommand As New OleDbCommand("SELECT * from tblgym WHERE Gdate = #" & Format(fdate, "G") & "#", MyConnection) Dim MyReader As OleDbDataReader = mycommand.ExecuteReader() MyReader.Read() I have tried to format the date but can not seem to change it Format(fdate, "DD/MM/YYYY") and Format(fdate, "ddmmyyy") but I just get the follwoing error Additional information: Cast from string "DD/04/YYYY" to type 'Date' is not valid. I have also tried to format it in the SQL statement as Format(fdate,"yyyymmdd") as I have done that before in Access but the program breaks on the following line Dim MyReader As OleDbDataReader = mycommand.ExecuteReader() Any Ideas as this is driving me nuts
  18. Thanks DiverDan that worked.
  19. I am using the follwoing code to add items to a list view from a Acces database Private Sub fillvgym() Dim clsconnect As New clsMain clsconnect.OpenConnect() rs.Open("Select * from tblgym", cnConnection, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic) Do While Not rs.EOF Me.lvgym.Items.Add(rs.Fields("ID").Value) Me.lvgym.Items(0).SubItems.Add(rs.Fields("Gdate").Value) rs.MoveNext() Loop End Sub The first item add ok but I cant seem to get the subitem to add I jsut get the follwoing error An unhandled exception of type 'System.Reflection.AmbiguousMatchException' occurred in microsoft.visualbasic.dll Additional information: No accessible overloaded 'ListViewSubItemCollection.Add' can be called without a narrowing conversion. I use to able to do this in VB5 but it seems to have changed alot in VB.NET
  20. I have been asked to design a program for the local sports club to schedule the clubs facilities ie tennis courts, sports hall etc. I am just not sure of the best way to achieve this. I will be holding the information in a database and just need some help with the scheduling part. I would be looking for a some sort of calender that would hold the date across the top and the time down the side and then fill bits in with colour when it had been booked. I have looked on the internet for a control as a front end for this but the only ones I have found aren't free. What would be the best way to do this. I did think about using the calender in Outlook but would rather have something all in VB. I really want something that looks professional and not just like a grid. I hope this makes sense
  21. I am looking for a free plug-in to be able to download/upload files and directories from an ftp site I have tried Chilkatftp plug-in and it works really well apart from I can't seem to download directors. or can anybody point me in the right direction to achieve this without a plug-in. Thanks
×
×
  • Create New...