|
That function takes parameter (an integer). The parameter is the index of the character whoes position you'd like to determine. You want the location of the cursor so the index should be SelectionStart. Your code should look like this: txtEditor.GetPositionFromCharIndex(txtEditor.SelectionStart)
|
|
|
|
|
|
If you follow the article posted by SudeeshPattath, then you can ask there in that article itself.
For more details post your error. We will help you out in solve the errror.
Regards,
Satips.
|
|
|
|
|
Socheat.Net wrote: when i drive to use it i get an error
Why dies every newbie always say "I get an error", but never says what the error is!!! This makes it virtually impossible to help you. Do you go to the doctor and just say "I'm sick."??
|
|
|
|
|
|
The pertinent points are :
1 - you say NOTHING about what is going wrong, so it's impossible to work out what the problem could be, and
2 - the article forum is the best place to ask about using the code in the article.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
|
There's a reason why that article is in Purgatory.
If you're having problems with a web-based service, contact the people who run that service. IF there's a problem with you account on that site, what is CP going to do about it?? Nothing!
|
|
|
|
|
This is what happens when you try to grab code you don't understand off the web. If you asked a programming question, I'd be happy to help you. The odds of me downloading an article code and spending a night playing with it, are close to zero, sorry.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
So, please help, i want to make application FTP, but i dont know how to do, give me a example.
Sohceat
................
|
|
|
|
|
Hi all,
I have 30 buttons and 1 textbox. When i click button, button's text will be displayed in textbox. It means i must write event for each button and i have 30 functions for 30 buttons. That's too long.
So how could i solve that by 1 function? (it means when 1 click a button, program will detect which button was clicked and get that button's text )
|
|
|
|
|
ctlqt12 wrote: It means i must write event for each button and i have 30 functions for 30 buttons.
No, it doesn't. The sender property on an event is the control that raised it. So, write one event that casts that to a Button, grabs the text and sets it to the textbox.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Have you noticed the Handles clause at the end of the method header for a button click??
Private Sub Button1_Click(blah, blah,) Handles Button1.Click
Well, you can tack on as many buttons as you want like this:
Private Sub Button1_Click(blah, blah,) Handles Button1.Click, Button2.Click, Button3.Click, ...
|
|
|
|
|
Hey..
What did you mean by a button's TEXT??
The name is Sandeep
|
|
|
|
|
after tagging the events as Dave Kreskowiak told with the handler
detect the particular button
dim b a button = ctype(sender,button)
select case b.name
case ""
.....
end select
|
|
|
|
|
use follwing code
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, ...Button30.Click
textbox1.text=sender.text '(or textbox1.text=textbox1.text & sender.text)
end sub
Hope this helps
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
Hi,
In which language are you writing the code for this? vb or vb.net? If in case of classic vb, use buttons as control array and write a single function. if in case of vb.net, write a event as follows :
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button5.Click, Button4.Click, Button3.Click, Button2.Click<br />
Dim kBtn As Button<br />
kBtn = sender<br />
TextBox1.Text = kBtn.Text<br />
End Sub
Here you can use the source button's properties using kBtn variable.
Thanks,
Kiran Kumar
|
|
|
|
|
Problem:
When i fetch a list of column values from database and store them into a String One dimentional Array, it gives me exception error "Null Reference", kindly can anyone help me out, whats wrong with my code?
<br />
<br />
myProfileNames.SetValue(pfDataSet.Tables("TimerDetails").Rows(j).Item("ProfileName").ToString, j)<br />
<br />
MsgBox(myProfileNames.GetValue(j))<br />
<br />
<br />
Code:
Public Class DataAccess
Private m_strAppPath As String
Private m_connectionString As String
Public m_connectionObject As New OleDbConnection
Private dataAdapter As OleDbDataAdapter
Private pfDataSet As DataSet
// One Dimentional Array to hold String Values fetched from Database...
Public myProfileNames() As String
// Public Subroutine that will be called through an instance of this
// class.
Public Sub LoadProfiles()
Dim ProfileCount As Integer
m_strAppPath = Directory.GetCurrentDirectory
m_connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & m_strAppPath & "\TimerData.mdb"
Try
If Not (m_connectionObject.State = ConnectionState.Open) Then
m_connectionObject.ConnectionString = m_connectionString
m_connectionObject.Open()
m_ConnectionStatus = True
End If
dataAdapter = New OleDbDataAdapter("Select * from ProfileMaster", m_connectionObject)
pfDataSet = New DataSet("TimerDetails")
dataAdapter.Fill(pfDataSet, "TimerDetails")
// GET the No. of Rows that exists in Dataset
ProfileCount = pfDataSet.Tables("TimerDetails").Rows.Count
If Not (ProfileCount = 0) Then
Dim j As Integer
For j = 0 To (ProfileCount - 1)
// =========================================================================
// This is Where Problem comes Stating that Null Refrence Exception occured
// =========================================================================
myProfileNames.SetValue(pfDataSet.Tables("TimerDetails").Rows(j).Item("ProfileName").ToString, j)
MsgBox(myProfileNames.GetValue(j))
// =========================================================================
Next
End If
Catch ex As Exception
MsgBox(ex.ToString)
Finally
If m_connectionObject.State = ConnectionState.Open Then
m_connectionObject.Close()
End If
End Try
End Sub
End Class
-- modified at 14:53 Monday 28th May, 2007
:- Rashid Ali -:
|
|
|
|
|
It seems to be that the result doesn't have a field named "ProfileName". Do you have such a field in the table?
Specify the fields that you want returned in the query, instead of using *. That makes debugging easier, plus it makes the query only fetch the data that you need.
---
single minded; short sighted; long gone;
|
|
|
|
|
Friends, i got ma problem fixed
// One Dimentional Array to hold String Values fetched from Database...
Public myProfileNames() As String <-- Wrong Initialization
public myprofileNames(10) as String <-- Problem Solved:-D
But i still want to know, what if i dont know, how mnay elements my array gona contain, how to dynamically initialize array elements.
anyone there for help?
:- Rashid Ali -:
|
|
|
|
|
That's what classes like List ( or ArrayList in .NET 1.0 and 1.1 ) are for.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Hi,
I need to disable a tabpage in a tabcontrol.
I 've tried to set the property "Enabled" to FALSE, but it doesn't shadow the text.
So I tried to set the forecolor property of the tabpage, but it doesn't work.
Finally I tried to draw each item by code as Microsoft suggests(through the drawitem event), but the result is really ugly (it losts the visual effects and the text doesn't fit in the bounds).
I cannot remove and re-add the pages for 2 reasons:
1) Each page could be enabled or disabled depending on several values in the form, so it is difficult to re-add the page in the right place
2) I LIKE the behaviour of old VB6 tabcontrol.
Can anyone help me ???
Thanx a lot.
Peace!
|
|
|
|
|
You two choices. One is to draw the tabs yourself, fixing your drawing code. I wish I had some examples to give you but I just about never use the TabControl, except in an Options dialog.
The other is to find a 3rd party TabControl that supports the visual effects you want. I don't know of any off the top of my head, well, because I just about never use the TabControl.
|
|
|
|
|
Hello
Try this that at the event of paint event of your tab page set its focus to some other or next object.
Example:
Private Sub tabpage1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles tabpage1.Paint
tabpage2.Selected = True
End Sub
Regards
Ali Raza
|
|
|
|
|
Nice idea, the controls inside the page don't respond anymore.
This can be obtained (with grayed controls) also by setting the property enabled of the tabpage...
But doesn't resolve the problem of graying the tabpage title.
Thanks, anyway.
For other friends: the command is TabPage2.Select (is a method, not a property).
Regards,
Advansis
Peace!
|
|
|
|