|
hi friend
you are use msscommlib.ocx. add project mscomm and set ComPort value 3.
add to project ; 1 button control , 1 timer , 1 textbox control
button control text = Connect
timer1 interval = 100
timer1 enable = false
-----------------------------------------------------------------------
Dim mscomm1 As New MSCommLib.MSComm
Send AT command to modem
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click<br />
<br />
Try<br />
mscomm1.CommPort = 3<br />
mscomm1.PortOpen = True<br />
mscomm1.Output = "AT#CID=1" & Chr(13)<br />
<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
<br />
<br />
mscomm1.Output = "AT%CCID=1" & Chr(13)<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
<br />
mscomm1.Output = "AT+VCID=1" & Chr(13)<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
<br />
mscomm1.Output = "AT#CC1" & Chr(13)<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
<br />
mscomm1.Output = "AT*ID1" & Chr(13)<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
<br />
Timer1.Enabled = True<br />
<br />
<br />
Catch ex As Exception<br />
MsgBox(ex.message)<br />
End Try<br />
<br />
<br />
End Sub<br />
anyone return OK value , your modem support CallerID , if all value return ERROR your modem not support CallerID.
now timer1.enable = true and my program listen a COM3 and return value write a textbox control.
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
End Sub
if telephone ringing , textbox control text changed and display callerID value
RING
DATE ........
TIME ........
NUMBER .......
RING
RING
--------------------------------------
get number value the text control
Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged<br />
modemcontrol()<br />
End Sub
<br />
Sub modemcontrol()<br />
Try<br />
Dim m As String<br />
Dim r As String = TextBox1.Text<br />
m = r.Substring(123, 1)<br />
<br />
If m = "0" Then<br />
r = r.Substring(123, 11)<br />
GoTo there<br />
End If<br />
<br />
If m = "P" Then<br />
<br />
Timer1.Enabled = False<br />
mscomm1.PortOpen = False<br />
<br />
TextBox1.Text = ""<br />
MsgBox("hidden number")<br />
<br />
<br />
Else<br />
<br />
r = r.Substring(123, 7)<br />
<br />
<br />
<br />
End If<br />
there:<br />
<br />
Timer1.Enabled = False<br />
<br />
mscomm1.PortOpen = False<br />
<br />
TextBox1.Text = ""<br />
<br />
msgbox("Call number : " & r )<br />
<br />
Catch ex As Exception<br />
<br />
End Try<br />
End Sub<br />
|
|
|
|
|
I am trying to bind a picturebox (and its associated picture) into a MS Access dB. I have been reviewing several snippets of code but each seem to confuse me more. I have everything working properly in regards to data binding textboxes but the picturebox is going easily.
I want to be able to bring up an openfiledialog box (from a browse button), browse for the image (jpg, bmp, tif, gif) and then scale it to the picture box size and allow the picturebox to adjust itself for portrait or landscale layout. Then I want my already existing save button to bind the picturebox with the rest of the data to an MS Access database.
Any help would be greatly appreciated! Thank you!!
Jason
I'd rather have a bottle in front of me than a frontal lobotomy.
|
|
|
|
|
hi
i am using vb.net 2005 and sql server 2005. i am save image this code ; select picture openfiledialog ;
<br />
<br />
Imports System.Data.SqlClient<br />
Imports System.IO<br />
<br />
Dim con As New SqlConnection("Data Source=.\sqlexpress;AttachDbFilename=|DataDirectory|\GlobalREST.mdf;Integrated Security=True;User Instance=True")<br />
Dim da As New SqlDataAdapter("Select * from URUNLER", con)<br />
<br />
da.MissingSchemaAction = MissingSchemaAction.AddWithKey<br />
Dim MyCB As SqlCommandBuilder = New SqlClient.SqlCommandBuilder(da)<br />
Dim ds As New DataSet()<br />
<br />
Dim fs As New FileStream(Me.ButtonEdit1.Text, FileMode.OpenOrCreate, FileAccess.Read)<br />
Dim MyData(fs.Length) As Byte<br />
fs.Read(MyData, 0, fs.Length)<br />
fs.Close()<br />
con.Open()<br />
da.Fill(ds, "URUNLER")<br />
Dim myRow As DataRow<br />
myRow = ds.Tables("URUNLER").NewRow()<br />
<br />
myRow("URUNKODU") = TextEdit2.EditValue<br />
myRow("URUNADI") = TextEdit3.EditValue<br />
myRow("URUNGRUBU") = "6"<br />
myRow("FIYAT1") = TextEdit4.EditValue<br />
myRow("FIYAT2") = TextEdit5.EditValue<br />
myRow("FIYAT3") = TextEdit6.EditValue<br />
myRow("FIYAT4") = TextEdit7.EditValue<br />
myRow("ACIKLAMA") = Me.MemoEdit1.EditValue<br />
myRow("RESIM") = MyData<br />
<br />
ds.Tables("URUNLER").Rows.Add(myRow)<br />
da.Update(ds, "URUNLER")<br />
<br />
fs = Nothing<br />
MyCB = Nothing<br />
ds = Nothing<br />
da = Nothing<br />
<br />
con.Close()<br />
con = Nothing<br />
<br />
<br />
but this code not work Access database. You are save picture file name and file location to access database. and select PictureBox component and expand DataBinding property click Advanced. Select PictureLocation value and select database picture location field.
|
|
|
|
|
hi everbody
i am using SerialPort component. set SerialPort1.PortName value COM3 , open port and listen COM3(modem).
<br />
<br />
Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived<br />
Dim returnStr As String = ""<br />
<br />
Do<br />
Dim Incoming As String = Me.SerialPort1.ReadLine<br />
If Incoming Is Nothing Then<br />
Exit Sub<br />
Else<br />
returnStr &= Incoming & vbCrLf<br />
Textbox1.Text = returnStr<br />
End If<br />
Loop<br />
<br />
Return<br />
End Sub<br />
<br />
if i am not using thread , my code is not working.
Error Code :
Cross-thread operation not valid: Control 'TextBox1' accessed from a thread other than the thread it was created on.
and i am using thread , my code is work.
<br />
<br />
Imports System<br />
Imports System.ComponentModel<br />
Imports System.Threading<br />
Imports System.Windows.Forms<br />
<br />
----------------------------------------------------<br />
<br />
Delegate Sub SetTextCallback(ByVal [text] As String)<br />
Private demoThread As Thread = Nothing<br />
<br />
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
Me.demoThread.Start()<br />
<br />
End Sub<br />
<br />
Private Sub SetText(ByVal [text] As String)<br />
<br />
If Me.TextBox1.InvokeRequired Then<br />
Dim d As New SetTextCallback(AddressOf SetText)<br />
Me.Invoke(d, New Object() {[text]})<br />
Else<br />
Me.TextBox1.Text = [text]<br />
End If<br />
<br />
End Sub<br />
<br />
Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived<br />
Dim returnStr As String = ""<br />
<br />
Do<br />
Dim Incoming As String = Me.SerialPort1.ReadLine<br />
If Incoming Is Nothing Then<br />
Exit Sub<br />
Else<br />
returnStr &= Incoming & vbCrLf<br />
SetText(returnStr)<br />
End If<br />
Loop<br />
<br />
Return<br />
End Sub<br />
<br />
<br />
<br />
but first call , text1.text ;
RING
DATE .......
NUMBER ...........
----------------------------------
second call text1.text ;
RING
DATE .......
NUMBER ...........
...........
.........
RING
DATE .......
NUMBER ............
.......
i am not clear text1.text. ?? how i do clear text1.text???
|
|
|
|
|
Hi all,
i have 3 tables
MultipleChoice
MultipleChoiceAnswer
Level
i wanto amke a join with these 3 where MultipleChoice.MID=MultipleChoiceAnswer.MID AND MultipleChoice.levelID=Level.LevelID
THx
Arshaad
Arshaad
|
|
|
|
|
Did you post this just to inform us, or do you have any problems with it?
---
b { font-weight: normal; }
|
|
|
|
|
I really need help.. sry if was ambiguous
Give the syntax pz
Thx
|
|
|
|
|
Really simple:
select *<br />
from MultipleChoice, MultipleChoiceAnswer, Level<br />
where MultipleChoice.MID=MultipleChoiceAnswer.MID AND MultipleChoice.levelID=Level.LevelID
or
select *<br />
from MultipleChoice<br />
inner join MultipleChoiceAnswer on MultipleChoice.MID=MultipleChoiceAnswer.MID<br />
inner join Level on MultipleChoice.levelID=Level.LevelID
---
b { font-weight: normal; }
|
|
|
|
|
mcqRecordset.Open "select * From MultipleChoice, MultipleChoiceAnswer,Level Where MultipleChoice.multipleChoiceID=MultipleChoiceAnswer.multipleChoiceID AND MultipleChoice.levelID=Level.levelID", myConnection, adOpenStatic, adLockOptimistic
Error: error in from clause
Thx again
|
|
|
|
|
Level is a reserved word. Rename the table.
---
b { font-weight: normal; }
|
|
|
|
|
hello, i made an ip messenger that can be used for chatting between 2 users only The server and the client. I used the tcpClient and vb.net.
I want to know how can i send a file (textfile) or what so ever via ip! can this be done?? thanks alot
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
How could i select a single speaker to play a sound with DirectSound?
I've a 5.1 soundcard which is configured as sorround sound, so that i can use the 6 outputs. This card appears in the system as one device (i have another 5.1 card and, with special drivers, it appears as 3 stereo devices, so it s easier to use, but i cannot use these drivers on the first card) and ive seen an application which can play a sound to a single speaker, so i should be able to do it too.
Ive thought about playing the sound as a 3D sound and selecting its position, but i dont think it s a good idea.
Any idea? Thx
|
|
|
|
|
<b>Dear Sir,
<b>
i amworking on vb.net
i have a textbox field in the form called CardId
now what i want is to generate numbers automatically and in a sequence.
Suppose,
when i click on the ADD RECORD button to add a new record, the cardid should be automatically generated as 1. if the record is saved ,then the next time when i am trying to add another record the cardid should be 2. but if the first record having cardid 1 is not saved then the next time i am adding a record the card id should be 1.
can u pl help me through code.</b></b>
Arun
|
|
|
|
|
dear arun,
You can refer the code below.
Function GenerateCode() As String
Dim MyCommand As SqlClient.SqlDataAdapter
Dim Dsg As New Customer
Dim LastRec As Integer
Try
MyCommand = New SqlClient.SqlDataAdapter("select * from Cusdetail order by 1 asc", Myconnection)
MyCommand.Fill(Dsg, "Cusdetail")
LastRec = Dsg.CusDetail.Count()
If LastRec > 0 Then
LastRec = LastRec - 1
TxtCusCode.Text = Ds.CusDetail(LastRec).CusCode + 1
Else
TxtCusCode.Text = "100001" 'Code for first Customer
End If
Catch ex As Exception
Label11.Text = ex.Message()
End Try
Myconnection.Close()
End Function
Thankx
Murtuza Patel.
|
|
|
|
|
this is easy...u can get the cardid field from the database into a dataset...and check for the largest number...and then add 1 to it and set it as ur generated number in the text box...
subhrajyoti
|
|
|
|
|
is it not easier to use Access for that sort of things?
|
|
|
|
|
Hello everybody!
I should write a program to power on & power off a video projector..
I use the SerialPort Class in the .NET Framework to transmit the necessary codes via a serial cabel that is connected to that video projector - it works fine (power on & power off)..
But now I should develop a GUI program to do that..
In that GUI program I need to specify on what time the specific code will be transmitted to the projector - maybe also the days (Monday until Friday or so..)
It could look like:
Start Time: 08:00
End Time: 11:00
From: Monday until Friday
In the codeproject messageboard I have found the "task scheduler class library". With that library I could create two scheduled tasks in win2k to perform "power on" and "power off". In order to that I will have to create two console-based programs executed by the scheduled tasks..
(http://www.codeproject.com/csharp/TSNewLib.asp[^]
But is there a better concept to achieve my goals?
Is there any other possibility to implement a timer to control the video projector at any one time?
Thanks in advance for any suggestion!
(Sorry for my English, it is not my first language)
|
|
|
|
|
Generally there are three ways of doing this:
:: Use the scheduler.
:: Let the program run in the background and wait until the right time.
:: Develop a service, that runs in the background and waits until the right time.
The third one is basically creating your own scheduler, so it might be a bit over the top for your project. Whether you should use the first or the second method mostly depends on if you want to have a program running constantly on the computer or not.
yomam wrote: Sorry for my English, it is not my first language
(Nor is it mine.) Even if your use of the language is not perfect, I find it far better than that of many users here that actually do have english as their first language. They just don't make an effort to use it correctly.
---
b { font-weight: normal; }
|
|
|
|
|
Thank you very much for your suggestions!
I think by using the task scheduler my requirements will be satisfied. Implementing my own scheduler would be a bit too much.. Therefore I will have to write some code to import all scheduled tasks with their settings and find the proper ones which are "responsible" for my video projector in order to make changes for power off and power on time..
|
|
|
|
|
i have developed an application using MS SQL, VB 6 usifn Seagate crystal reports. i want to create this application as a demo version, for this i need to go for putting the expiry date for the application. how can i do that ? or something to be done during pacakage and deployment ?
thanx a lot ..
furher
|
|
|
|
|
i have got an idea...try this...during the form load of ur main form...store the date of first run in a text file through file commands at an unknown location...e.g. windows/system32...
and then every time the user runs...the formload checks for thr file and reads the date and comapares with the currnt date...if it doesnt find the file then its the first run and u need to create the file...and u can set the date to any number of days after the first run date....
subhrajyoti
|
|
|
|
|
Hi Rikky,
Thanx for ur response.
I will surely try this.
But there is a small problem.
If suppose the file is renamed or deleted, then the demo version will be of no use.
Thanx & Regards.
Success is not a Destination,
... But a Journey !!
|
|
|
|
|
Hi Furher,
Iam also looking for the same code.
Thanx & Regards.
Success is not a Destination,
... But a Journey !!
|
|
|
|
|
Hi,
I would like to write a program that loads an image and scans each pixel in turn from left to right and from top to bottom. When the pixel is scanned I need to find out the color value e.g. #FF0000
I am not new to programming its just that I have not programmed using graphic functions before.
If anyone could possibly point me in the right direction I would appreciate it.
Many Thanks
Julian Mummery
www.IJude.com
|
|
|
|
|
when you load a image you can get its Image type which you cast into a Bitmap.
Then you have a GetPixel(x,y) method avalible.
Then you just loop trough the width and height of the image and you will get the pixel information (you will get a Color ).
But I must warn you that this is really slow (I had some spare tiem yesterday and I have written a small app that does just that).
--------------------------------------------------------
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|