Tuesday, November 24, 2009

Is keyboard / keypad not appearing in wince smart device mobile application for text entry?

Have you wondered why keyboard / keypad not appearing for the textbox if any entry in the mobile device? Dont imagine it will appear automatically.

The solution is quite simple and you will be amazed too.

While running the application in the emulator if there is any text entry it will show as below








but for certain forms the icon  or the key board wont appear like this.




The solution is quite simple ; while adding a new form in the project by default menu1 will appear i think you would have noticed. At any cost dont delete it. Since it plays a major role in showing the keyboard / keypad where ever the textbox appears in the form.

If you delete it unexpectly, then from the toolbox browse for navigation and place the menu control in the form.Thats enough :-) wallaaa the keyboad appears in the form or in the device !!!!!!.



                                       
                                             

You can delete the menu control from the form where ever there is no textbox.

I know the solution would not have satisfied you; the same with me too. Still now i am wondereing what is the conenction between the menu control and the windows mobile form.


Voice recording wince smart device mobile application

Voice recording wince mobile application - While working on mobile projects in most of the scenario there will be a requirement for voice recording at least 75%. I have searched a lot to use dot net compact frameworks dll but i couldn't at last i figured it is not possible using compact frameworks dll.

We can achieve the same thing using pinvoke i.e. Platform Invoke. I will just place the sample code so that you can follow up.

Read this post first before proceeding as you need to know about opennetcf

Code:



create a new form named frmVoice.vb
place button btnstart

 btnstart onclick event
************** START ****************

Private audioRecorder As OpenNETCF.Media.WaveAudio.Recorder
Dim voicefolder As String = "\My Documents\Voice"
Dim voicefile As String = voicefolder + "\Record1.wav"
Const RECORD_DURATION As Integer = 45

 If System.IO.Directory.Exists(voicefolder) = False Then
                System.IO.Directory.CreateDirectory(voicefolder)
            Else
                Dim s As String
                For Each s In System.IO.Directory.GetFiles(voicefolder)
                    System.IO.File.Delete(s)
                Next s
            End If

            Dim fs As FileStream = File.Create(voicefile)
            fs.Close()


            Dim audioStream As System.IO.Stream

            audioStream = System.IO.File.OpenWrite(voicefile)
            audioRecorder = New OpenNETCF.Media.WaveAudio.Recorder

            '---save the audio to stream---
            audioRecorder.RecordFor( _
               audioStream, _
               RECORD_DURATION, _
               OpenNETCF.Media.WaveAudio.SoundFormats.Mono16bit11kHz)



place another button stop
on stop click event

 audioRecorder.Stop()



**************   END   ****************