|
how can i send a right click event to my application and more over can i get any help how can i simulate double click event in that same application.I want help in VB.net for these events any clue how can i impliment them
farah
|
|
|
|
|
Why do you want to ? Send them from where ? The obvious thing to do is to write a method that is called by your right click event, and call it when ever else you need to.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i just want to code a right click that works the same way as normal right click funtion does that is when i right click on any control in VB.net or over any where else outside my VB.net application it performs the right click function i want to write the code in VB.net but i am new to VB.net environment so i am having problem in coding it and i am also having problem to code double click event too .
farah
|
|
|
|
|
I suspect you need to use p/invoke to simulate right clicks. I don't know that the framework lets you.
Your question the second tme is different to the first time. Also, why are you having problems with the double click event ? What bit is the problem?
farah mazhar wrote: but i am new to VB.net environment
Sounds like a classic case of someone picking up a compiler and trying to use it without learning how first. What are you trying to write that your first VB project needs to simulate right clicks across the entire system ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
yes you right i want my right click to work over the whole system through VB.net program
farah
|
|
|
|
|
I know. I was hoping when I saw your reply that you'd actually answered the questions I asked you.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I wish to create the report using the code and to be print out the same report from current form as the current transaction number
thanks
haneefa
|
|
|
|
|
I am trying to read a variable number of bytes from another .Net application but I can't ever get the whole message to read in properly. I have a string with ids and data values (id:value|id:value|...) that I convert to bytes before sending. I keep reading on forums that the standard way of reading a variable number of bytes is to add the number of bytes on the front of the message but I cannot find any examples of how to do that. I can add the length in bytes to the string but then I have to convert that to bytes to transmit so it doesnt seem to help. Am I missing something
Any help would be appreciated - I am on a time crunch
|
|
|
|
|
You said much, but nothing useful to diagnose the problem. We'd have to see the code the you're using to both send and receive the information. TCP?? So you've implemented a socket server and client in your app??
|
|
|
|
|
Here is my code
Sending code
Public Sub Send(ByVal dataToSend As String)
Try
bytesToSend() As Byte = System.Text.ASCIIEncoding.ASCII.GetBytes(dataToSend)
mysocket.Send(bytesToSend,0,bytesToSend.Length)
Catch se as SocketException
MsgBox(se.ToString)
End Try
End Sub
Receiving
Private Class StateClass
Public clientSocket As Socket
Public clientBuffer() As Byte ------> how do i know the buffer size before hand
End Sub
Public Sub OnAcceptConnection(ByVal result as IAsyncResult)
Dim state as New stateClass
Dim serverSocket As Socket = CType(result.AsyncState, Socket)
Try
state.clientSocket = serverSocet.EndAccept(result)
state.clientSocket.BeginReceive(state.clientBuffer,0,state.clientBuffer.Length,SocketFlags.None, _
New AsyncCallback(AddressOf ReceiveCallback,stateClass)
Catch acceptex as Exception
MsgBox(acceptex.ToString)
EndTry
EndSub
Private ReceiveCallback(ByVal result2 as IAsyncResult)
Try
Dim state As stateClass,CType(result2.AyncState,stateClass)
Dim numberBytesRead As Int32 = state.clientSocket.EndReceive(result2)
If numberBytesRead >0 Then
Dim receivedString As String = ASCII.GetString(state.clientBuffer)
Console.WriteLine(receivedString)
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
|
|
|
|
|
captainmogo wrote: Private Class StateClass
Public clientSocket As Socket
Public clientBuffer() As Byte ------> how do i know the buffer size before hand
End Sub
You don't let this size be variable, you set it to a static value, say 4K. You'll have to adjust this size for your own requirements.
Private Class StateClass
Public clientSocket As Socket
Public clientBuffer(4096) As Byte
End Class
|
|
|
|
|
If I set it to, say 4k and the message that I am sending is larger than that - it wont get all of it unless I loop it with .BeginReceive again. I have tried that in the past and still have not gotten it to work properly. The .BeginReceive never fires a second time. I am not sure what I am doing wrong which is why I was hoping there was a good example out there. I have 4 channels each of very different size but only 1 stateclass - so how do i adjust it to fit each channel. Is this even possible.
|
|
|
|
|
captainmogo wrote: it wont get all of it unless I loop it with .BeginReceive again. I have tried that in the past and still have not gotten it to work properly. The .BeginReceive never fires a second time.
This is because you have to setup another Async Begin Read at the end of your ReceiveCallback.
Private Sub ReceiveCallback(yada)
yada, yada, yada
' Convert another chunk of the data to whatever you need...
' Invoke any control update methods you need...
' and last but not least, setup and fire off another BeginRead...
StartAsyncRead()
End Sub
StartAsyncRead is where you create a State object and call the BeginRead method again.
captainmogo wrote: I have 4 channels each of very different size but only 1 stateclass - so how do i adjust it to fit each channel.
The buffer size has to be big enough to hold either an entire message. OR the code breaking down the message into bytes has to fit as much as it can in the buffer and wait for another chance to send the next chunk. OR you leave it a variable size and ReDim the buffer to a known size defore you fill it. OR you could even just create 4 different size State classes.
|
|
|
|
|
Hi, I currently using VB.NET with Rich Text Box control, if focus my cursor wherever, can i get high light background? (example if i focus in column 2 it will high light only column 2).
Socheat
|
|
|
|
|
There's a problem with that. There is no "column 2". The RTB doesn't have columns, just lines, which can span multiple visible rows in the RTB and characters in that line.
For instance, in the RTB, this is one line (if there is no carriage return entered anywhere in the text):
--This is one line. This is one line. This is one
line. This is one line. This is one line. This is
one line. This is one line. This is one line. Thi
s is one line. This is one line. This is one line
. This is one line. This is one line. This is one
line. This is one line. This is one line. This i
s one line. This is one line. This is one line.[ENTER]
Now, your code could go through every line in the RTB and highlight the second character of each line, but in the above example, only one character would get highlighted, the second one on the first row of characters. Line two doesn't begin until after the [ENTER].
|
|
|
|
|
Below are my codes
Dim Position As Integer = Me.RichTextBoxMy.SelectionStart
Dim Line As Integer = Me.RichTextBoxMy.GetLineFromCharIndex(Position) + 1
Dim Col As Integer = Position - Me.RichTextBoxMy.GetFirstCharIndexOfCurrentLine + 1
Codes above I can get Column and Line from RTB
If i have many line and if I focus in one line that i can get from RTB, do you know how to highlight background for that line only, if cursor move to other it will highlight other too.
Would you mind give me a example code?
Thanks
-- modified at 10:45 Saturday 6th October, 2007
Socheat
|
|
|
|
|
Hello Everybody
Im doing a Library Project for my college. Need some guideline follows.........
Is it possible all information contain a MDIParent page, Like when I click AddNewMember then the frmAddNewMember form will be appear on (MDIParrent Dock Fill) after fill up this form a confirmation page will be come with a NewMemberID which will be appear on (Dock Fill). If you have a look on Microsoft Office Outlook then you will understand what I want to do.
Any instruction will be really helpful.
Sarfarj Ahmed
|
|
|
|
|
From the description, you don't need an MDI app to do this.
Sarfaraj Ahmed wrote: If you have a look on Microsoft Office Outlook then you will understand what I want to do.
I use Outlook and, no, I still have no idea what you want to do other than fill in the fields of a form. Why would you want to use an MDI form to do this?
|
|
|
|
|
Thanks,
I have Designed my project
I have two panel on my project. Left panel contain manu like add newMember, newBook, borrowBook, returnBook etc. When I will click any option then Right Panel will fill that information like newMemberRegister form, borrowBook form.
like function newMember()
when I will call this function then Right Panel will fill frmNewMember
any idea?
Thanks
Sarfaraj
Sarfarj Ahmed
|
|
|
|
|
You don't need an MDI form to do this. Among newbies, MDI is probably the second most abused idea, next to using a PictureBox to draw everything.
Make up your forms as normal. When you need to create a form and show it in the panel, you do something like this:
Dim currentForm As New BorrowBookForm()
currentForm.TopLevel = False
RightSidePanel.Controls.Add(currentForm)
You'll have to manage keeping only one form in that panel and destroying the previous form before putting the new one in the Panel. This is because if you don't, you'll run the system out of resources due to exhaustion of the handle pool.
|
|
|
|
|
Dear Dave
what I done is , I have add two form on the project form1 and form2
form on:
I have taken two panel panel1 and panel2
On panel1 i have add a button and panel2 is empty. On button click event i wrote code you given
Dim currentForm As New form2()
currentForm.TopLevel = False
panel2.Controls.Add(currentForm)
But can't see the form2 on panel2. waiting for your reply
Sarfarj Ahmed
|
|
|
|
|
So much for the ability to do research...
currentForm.Show()
|
|
|
|
|
Dave
Thanks a lot. it does work. Dave I got question, Im doing a Library Mangement Project and it has to be desktop and internet based. Basically Member can login on internet, they can view their report. But in the library it has to be really fast. Also I have to maintain same server for desktop and internet. library will get Intranet connection and member will get internet connection.
wot your suggestion
waiting for your reply
Sarfarj Ahmed
|
|
|
|
|
Sarfaraj Ahmed wrote: wot your suggestion
Suggestion for what??
|
|
|
|
|
Thanks For Replying ,
Hi , now i am using my own custom propertygrid for runtime controls when i am clicking on textbox it is showing properties . I am showing font,backcolor,location ,like some properties
1) How to create the wordwrap,TextAlign properties .
2) Now the problem arises with borderstyle ,Multiline and some other Properties while selecting textbox, I am not able to set these properties .These are not there by default for runtime ctr.I created the properties for borderstyle,. I dont know how to create the property for TextAlign . NOt Coming with (System.Win.Forms.TextboxBase)
.Dim ctr as control --- TRhen i am getting properties butnot borderstyle,textalign ,etc
3) In PropertyGrid1_PropertyValueChanged , i am writing like this
Case "Font"<br />
ctr.Font = e.ChangedItem.Value<br />
Select Case e.ChangedItem.Label<br />
<br />
Case "BackColor"<br />
ctr.BackColor = e.ChangedItem.Value<br />
<br />
Case "BorderStyle"<br />
if ctype(sender,TextBox) then '''Borderstyle not coming <br />
ctr.BorderStyle( Not Coming) = e.ChangedItem.Value <br />
<br />
Dim ctr As New TextBox ''If i use like this only borderstyle is coming "<br />
ctr.BorderStyle( Coming) = e.ChangedItem.Value ' but Not working
waiting For Reply ......
DVSriram
|
|
|
|