|
hello everyone
I need your help to achieve my MapWinGIS project Visual Basic.NET,
I wonder how to write a procedure that allows viewing the positions on the map with the symbology of my choice and displayed according to the selection in the legend group using the CheckedChanged event categories.
thank you
|
|
|
|
|
hi, will somebody give me a code in vb which will be able to receive sms using a usb gsm modem?
please help. thanks.
|
|
|
|
|
No. That's not how it works around here.
We'll help you with problems with YOUR code, but not write it for you.
You're not writing our code for us while we're writing your code for you, so...
|
|
|
|
|
'class code
Imports System.IO.Ports
Imports System.Threading
Public Class SMSCOMMS
Private WithEvents SMSPort As SerialPort
Private SMSThread As Thread
Private ReadThread As Thread
Shared _Continue As Boolean = False
Shared _ContSMS As Boolean = False
Private _Wait As Boolean = False
Shared _ReadPort As Boolean = False
Public Event Sending(ByVal Done As Boolean)
Public Event DataReceived(ByVal Message As String)
Public Sub New(ByRef COMMPORT As String)
SMSPort = New SerialPort
With SMSPort
.PortName = COMMPORT
.BaudRate = 9600
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
.Handshake = Handshake.RequestToSend
.DtrEnable = True
.RtsEnable = True
.NewLine = vbCrLf
End With
ReadThread = New Thread(AddressOf ReadPort)
End Sub
Public Sub SendSMS(ByVal CellNumber As String, ByVal SMSMessage As String)
Dim MyMessage As String = Nothing
If SMSMessage.Length <= 160 Then
MyMessage = SMSMessage
Else
MyMessage = Mid(SMSMessage, 1, 160)
End If
If IsOpen = True Then
SMSPort.WriteLine("AT")
Thread.Sleep(1000)
SMSPort.WriteLine("AT+CMGF=1" & vbCrLf) 'setting modem for sms mode
Thread.Sleep(1000)
'SMSPort.WriteLine("AT+CSCA=""+254722500059" & vbCrLf) 'setting the message service center number
SMSPort.WriteLine("AT+CMGS=""" & CellNumber & """" & vbCrLf)
Thread.Sleep(1000)
'SMSPort.WriteLine("AT+CMGS=" & CellNumber & vbCrLf)
_ContSMS = False
SMSPort.WriteLine(MyMessage & vbCrLf & Chr(26))
Thread.Sleep(1000)
_Continue = False
RaiseEvent Sending(False)
'MessageBox.Show("Successfully sent")
End If
End Sub
Private Sub ReadPort()
Dim SerialIn As String = Nothing
Dim RXBuffer(SMSPort.ReadBufferSize) As Byte
Dim SMSMessage As String = Nothing
Dim Strpos As Integer = 0
Dim TmpStr As String = Nothing
Try
Catch ex As Exception
While SMSPort.IsOpen = True
If (SMSPort.BytesToRead <> 0) And (
SMSPort.IsOpen = True) Then
While SMSPort.BytesToRead <> 0
SMSPort.Read(RXBuffer, 0, SMSPort.ReadBufferSize)
SerialIn =
SerialIn & System.Text.Encoding.ASCII.GetString(
RXBuffer)
If SerialIn.Contains(">") = True Then
_ContSMS = True
End If
If SerialIn.Contains("+CMGS:") = True Then
_Continue = True
RaiseEvent Sending(True)
_Wait = False
SerialIn = String.Empty
ReDim RXBuffer(SMSPort.ReadBufferSize)
End If
End While
RaiseEvent DataReceived(SerialIn)
SerialIn = String.Empty
ReDim RXBuffer(SMSPort.ReadBufferSize)
End If
End While
End Try
End Sub
Public ReadOnly Property IsOpen() As Boolean
Get
If SMSPort.IsOpen = True Then
IsOpen = True
Else
IsOpen = False
End If
End Get
End Property
Public Sub Open()
If IsOpen = False Then
SMSPort.Open()
ReadThread.Start()
End If
End Sub
Public Sub Close()
If IsOpen = True Then
SMSPort.Close()
End If
End Sub
End Class
'window form
'Form Code
Imports System
Imports System.Threading
Imports System.ComponentModel
Imports System.IO.Ports
Imports mordemsms.SMSCOMMS
Public Class Form1
Private Sub sendbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sendbtn.Click
Dim sms As SMSCOMMS
sms = New SMSCOMMS("COM12")
sms.Open()
sms.SendSMS(TextBox1.Text, TextBox2.Text)
sms.Close()
End Sub
End Class
ok. this is the code i have written to receive an sms. i want to add the function to receive a sms on the same modem. i am unable to go on. somebody help please.
|
|
|
|
|
Hello !
I'm using Entity framework 6 with Sql server 2008r2.
But I have noticed that even a small query ( with only 2-3 records ) need about 25 seconds to execute.
This happens everytime when I execute a query for the first time.The second time is more fast. But if I open another form and execute another query , there's again a delay.
what can I do ?
Thank you !
|
|
|
|
|
This was a problem with EF 6.0 that has been fixed in the latest update, I believe it is 6.0.2 that fixes it.
Open the Package Manager console in your project and type
Update-Package EntityFramework
|
|
|
|
|
Hello !
I have update it , but it's the same situation.
|
|
|
|
|
In that case I have idea what it is.
|
|
|
|
|
Hello !
I thought to use Pre-Generated views.
I have installed "Interactive Pre-Generated Views for Entity Framework 6 "
- On Console Manager : install-package EFInteractiveViews
- On my main form I have this :
Imports InteractivePreGeneratedViews
Private Sub IntViews()
Using ctx = New MyEntities()
InteractiveViews.SetViewCacheFactory(ctx,NewFileViewCacheFactory("C:\Myprog\MyViews.xml"))
End Using
End Sub
Now I get 2 errors :
Error 104 :
Error 105 : Type
What can I do ?
Thank you !
|
|
|
|
|
I have no idea. I've never used that.
I'm still on EF5.
|
|
|
|
|
|
Hello everyone,
I want to create a text file when a program loads for the first time and refer it every time when we load the form or activate the form.
Open "C:\" & "filename.txt" For Output As #1
register = CStr(Date)
Print #1, register
Close #1
This sample code is working on Win XP but its not creating txt file in Win 7. Please let me know how to make them work in 7 or 8 as well. Thanks in advance.
|
|
|
|
|
reason for it not working on Win7 is UAC[^].
it is suggested that you then look at writing files into the app data folder of the user.
The first answer from this link[^] gives you a good example of how to do it
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
|
how can i develop 8-puzzle game in order to work automatically rather than manually? by using vb6.
mpk
|
|
|
|
|
You can start by reading this post![^]
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
Why would you START a development in a tool that has been dead for a DECADE. Get the Express version of VB.Net.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
how can i develop 8-puzzle game in order to work automatically rather than manually?
|
|
|
|
|
The code below works like I want it to so far, by selecting specific cells in one worksheet and pasting in specific columns on another. When I change the data is D10, D12 and D14, how do I get it to paste on the other worksheet in the next available cell for that column?
Sub Button1_Click()
lMaxRows = Sheets("Sheet4").Cells(Rows.Count, 4).End(xlUp).Row
Sheets("Sheet4").Cells(lMaxRows, 4) = Sheets("Sheet1").Range("D12")
Dim LR As Long
Sheets("Sheet4").Select
'your paste to sheet name
'Last Row in "Sheet4" - change column as you need
LR = Sheets("Sheet4").Range("D" & Rows.Count).End(xlUp).Row
Range("D" & LR).Select
'change A as you need - it selects the last row
'Paste
lMaxRows = Sheets("Sheet4").Cells(Rows.Count, 5).End(xlUp).Row
Sheets("Sheet4").Cells(lMaxRows, 5) = Sheets("Sheet1").Range("D14")
lMaxRows = Sheets("Sheet4").Cells(Rows.Count, 5).End(xlUp).Row
Sheets("Sheet4").Cells(lMaxRows, 6) = Sheets("Sheet1").Range("D10")
|
|
|
|
|
What libraries are you using? Interop with Excel, or a third-party?
As it reads, the first two lines should do the trick; you're fetching the last cell, and writing the contents of Sheet1$D12.
David Rubin wrote: how do I get it to paste on the other worksheet in the next available cell for that column? Pasting is a lousy way of aggregating choices. Launch VB, read that file, and write a decent UI for it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I thought it would work too, but when I change those cells it just copies over the previously pasted data.
I am very new to this, so I dont understand everything.
|
|
|
|
|
Copying/pasting is not behaviour that applications should override; the clipboard is an OS-function. Most likely it's Windows that's biting you
Ensure that it does find the "next free row", or take the time to write a UI. A CheckedListBox sounds convenient; you show your options, the user presses "spacebar" to select an item, or cursor-down to go to the next item. Wouldn't that be a friendlier way to get a selection?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Again, I am new at this. None of what you just said makes any sense to me. Do you know how to help me figure out how to make my code work?
|
|
|
|
|
David Rubin wrote: Again, I am new at this. All of us started that way.
David Rubin wrote: None of what you just said makes any sense to me. Copying/pasting is something that's baked into Windows; and it's hard for applications to change it's behaviour, because it's deemed an important function.
Can you give me a brief idea of what you're trying to achieve? It looks like you want to have the user make a list of things.
David Rubin wrote: Do you know how to help me figure out how to make my code work? I'm not on a machine with Excel atm, but I'll be running the code later. As the second line of code, insert the line below;
Sheets("Sheet1").Cells(1, 1) = lMaxRows That should tell you what is considered to be the "next free cell".
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Here is what I am trying to achieve.
I have one workbook, with two different sheets (Sheet1 and Sheet4). I am trying to copy the following cells on Sheet1 to specific cells/columns in Sheet4 with the click of a button.
Sheet1 D10 to Sheet4 column B in the next available cell
Sheet1 D12 to Sheet4 column D in the next available cell
Sheet1 D14 to Sheet4 column E in the next available cell
Sheet1 E22 to Sheet4 column C in the next available cell
Right now I can get it to work in terms of getting the cells to copy and paste properly to sheet4, but when I click the button again, it just replaces the information in those cells. Every time I click the button, I will need it to fill in the next available cell for the columns listed above.
Your help is appreciated.
|
|
|
|