|
You're welcome.
I would not reinstall anything until I was convinced the approach and code are valid (unless there were other reasons to suspect a couple of things of course).
I would research more, and try on another system. I suggest you also try some totally different code that relies on the same parts, maybe something from here[^].
|
|
|
|
|
Hi Luc,
just to let you know: I don't know how and which, but one of my todays steps solved the issue! After your hint I got a bit into the tracing of VB, which helped here and will help me in the future, too. For this one it's quite likely that it was a registration issue... Thanks again.
|
|
|
|
|
Hi,
i've a 2 sim mobilephone and I have the following problem: I want to create a software (in vb.net or c#) that allows me to assign each number stored in the phonebook with one sim. In this way I could call one vodafone number with my vodafone sim and one number Tim with my Tim sim. Can you help me?
I hope to be clear and have been written correctly in English
|
|
|
|
|
How you do that depends entirely on the phones themselves and if you can get an SDK or whatever you have ot do to communicate with the phones. You're best source of information is going to be the manufacturer of the phones. What you're thinking of doing is VERY specialized and you're not likely to get any help on how to do this from here. You need to find a forum more specific to "hacking" your phone than this one.
|
|
|
|
|
ok, but at least is It easy to know where the register is set to choose the sim for call?
|
|
|
|
|
Only through the SDK documentation on the phone.
I have no experience with it myself, but I at least know where'd I look for the information.
|
|
|
|
|
I have looked for an explanation to why the following code is resulting in the error
"Overload resolution failed because no 'SetSelectedCellCore' is accessible." on the line
dgvStudents.SetSelectedCellCore(0, 0, True)
I have no controls on my form. I am running Win7 and Visual Basic Express 2008, but i get the same result on my WinXP machine running VB Express 2008. Any help would be appreciated.
Imports System.Windows.Forms
Public Class Exercise
Dim dgvStudents As MyDataGridView = New MyDataGridView
Private Sub Exercise_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Text = "Students Records"
dgvStudents = New MyDataGridView()
dgvStudents.Location = New Point(12, 12)
dgvStudents.Size = New Size(650, 100)
Dim colFullName As DataGridViewColumn = New DataGridViewColumn
colFullName.Name = "FullName"
colFullName.HeaderText = "Full Name"
Dim celFullName As DataGridViewCell = New DataGridViewTextBoxCell
colFullName.CellTemplate = celFullName
dgvStudents.Columns.Add(colFullName)
Dim colPhone As DataGridViewColumn = New DataGridViewColumn
colPhone.Name = "PhNum"
colPhone.HeaderText = "Ph Number"
Dim celPhone As DataGridViewCell = New DataGridViewTextBoxCell
colPhone.CellTemplate = celPhone
dgvStudents.Columns.Add(colPhone)
Controls.Add(dgvStudents)
dgvStudents.SetSelectedCellCore(0, 0, True)
End Sub
End Class
Public Class MyDataGridView
Inherits DataGridView
Protected Overrides Sub SetSelectedCellCore( _
ByVal columnIndex As Integer, _
ByVal rowIndex As Integer, _
ByVal selected As Boolean)
MyBase.SetSelectedCellCore(columnIndex, rowIndex, selected)
End Sub
End Class
modified on Wednesday, May 12, 2010 1:46 PM
|
|
|
|
|
The overridden method remains protected and can only be accessed from within your MyDataGridView class. A public wrapper method would be needed to do what you want as the SetSelectedCellCore method's access modifier cannot be changed from protected to public.
Alan.
|
|
|
|
|
This is a protected method which means that you can't access it directly. AFAIK you can only access it from within the class.
Generally, the only time you would want to override this method was if you wanted to prevent a user from focusing on a particular cell.
Why not just do
dgvStudents.Rows(0).Cells(0).Selected = True
I would not suggest overriding a protected method to do something it's not meant to do...but...
you could just add a new method within your MyDataGridView class called something like MySetSelectedCellCore that simply calls your overridden SetSelectedCellCore . Then you just call that MySetSelectedCellCore . It would look like:
Public Class myDataGridView
Inherits DataGridView
Protected Overrides Sub SetSelectedCellCore(ByVal columnIndex As Integer, ByVal rowIndex As Integer, ByVal selected As Boolean)
MyBase.SetSelectedCellCore(columnIndex, rowIndex, selected)
End Sub
Public Sub MySetSelectedCellCore(ByVal columnIndex As Integer, ByVal rowIndex As Integer, ByVal selected As Boolean)
SetSelectedCellCore(columnIndex, rowIndex, selected)
End Sub
End Class
though again, I must stress, that's not what it was intended to do and not the best way to do what it looks like you are trying to do.
|
|
|
|
|
Thanks, both of you, for the pointers. I have learned a couple of different ways to do this now. I should be able to apply this to different objects as well.
|
|
|
|
|
Just as an FYI, when you call
dgvStudents.Rows(0).Cells(0).Selected = True the DataGridView implements this by making a call to SetSelectedCellCore You can see this by using the class you created as listed in your OP and setting a breakpoint on
MyBase.SetSelectedCellCore(columnIndex, rowIndex, selected) then calling
dgvStudents.Rows(0).Cells(0).Selected = True .
|
|
|
|
|
I did notice that, so I went searching for the reason that it worked... I did a little bit of VB6 as a hobby and wondered what could be so drastically different in vb.net. now i need to move a program I wrote in VB6 over to .net. I think I might like the new OOP paradigm, but only time will tell, and there's a little bit of a learning curve here.
|
|
|
|
|
hi
how to parse the Excel worksheet and write the data to a file using VBA Scripting ?
kindly provide me the tutorial to implement this task.
Thanks in Advance,
Narendra
|
|
|
|
|
Here is a snipet of VBA code that loops through a sheet and sets a cell value. (nothing really useful)
What it does show you is how you can loop through cells and get their values.
Hope this helps.
Sub DEMOscript()
'
Dim i As Integer
Dim r As Integer
r = MsgBox("This will clear the contents of Sheet1", vbOKCancel, "Confirm Processing")
If (r = 1) Then
Sheet1.Cells.Clear
totalrows = ActiveSheet.UsedRange.Rows.Count
For i = 2 To totalrows
Sheets("Sheet1").Cells(i, 2).Value = i
Next i
Else
MsgBox ("No processing performed.")
End If
End Sub
|
|
|
|
|
In addition to Davids snippet I would recommend you to use Intellisense as much as you can. It's easy, gives you some inspiration even while typing, and helps flatten your learning curve Let me give you an example:
If MsgBox("This will clear the contents of Sheet1", vbOKCancel, "Confirm Processing") = vbOK then ... instead of the (unnecessary) r variable shows you the possible results of the message box, so that you wouldn't have to guess the value.
|
|
|
|
|
|
How can I search all the files available on my computer (C,D,E,F...) drives like search functionality in windows.
The application should search the subfolder as well in the drives.
I want to have a list of all the files available in my computer.
Thanks In Advance
|
|
|
|
|
That's going to be slooow..
The recipe first;- List all drives (Google for a snippet)
- Create a recursive function to loop all folders in that drive
- Proces all files and folders that the function returns
ejaz_pk wrote: like search functionality in windows.
That one allows you to search "within" files, and is more complex then the recipe above. Do you want to "list" all your files, or do you want to search their contents?
I are Troll
|
|
|
|
|
I just want file names list and path of the files.
|
|
|
|
|
The hardest part would be the recursive funtion to scan the folders. There's an example on that over here[^], and also on the Knowledge Base[^].
The rest is up to you
I are Troll
|
|
|
|
|
Easily done by shelling to a DOS command that creates a text file, then parsing this if necessary:
The following DOS command will create a file called Output.txt with a list of all files (not including system or hidden) on drive c: - the /s recurses subdirectories, and the /b restricts the output to filename only.
DIR C: /s /b >Output.txt
====================================
Transvestites - Roberts in Disguise!
====================================
|
|
|
|
|
How to Redirect a LinkLabel from one window form to another window form in VB 2005?
|
|
|
|
|
form.show
or
form.ShowDialog
SOFTDEV
If you have knowledge, let others light their candles at it. [ Let's work to help developers, not make them feel stupid ]
|
|
|
|
|
Hi,everyone.I am hoping that the text that I input in the textbox can be captured in the
excel each sheet ,column 3, rows 2-20 for example.
Code like under,I think there are many errors in it,please tell me how to write it,please.
Thanks!
Imports Office = Microsoft.Office.Core
Imports Microsoft.Office.Interop.Excel
Private Sub OperateExcel()
Dim Xls As Object
Dim Xlsbook As Excel.Workbook
Dim Xlssheet As Excel.Worksheet
Dim Xlsrange As Excel.Range
Xls = CreateObject("excel.application")
Xlsbook = Xls.Workbooks.open("D:\text.xls")
Xls.Visible = True
Xlssheet = Xlsbook.Worksheets("sheet1")
For Each Xlssheet In Xls.Xlsbook
Xlsrange = Xlssheet.Range("H3")
Xlsrange.Value = txtProduct.Text
Xlsrange = Xlssheet.Range("H4")
Xlsrange.Value = txtName.Text
Xlsrange = Xlssheet.Range("H5")
Xlsrange.Value = txtNum.Text
Next
Xlsbook.Close()
Xls.Quit()
releaseObject(Xls)
releaseObject(Xlsbook)
releaseObject(Xlssheet)
End Sub
modified on Friday, May 7, 2010 1:12 AM
|
|
|
|
|
Where to start...
I am not exactly sure what you are trying to achieve, and I take it you assembled this code from examples, or copied it as is.
So let's start from the beginning. If you suspect that this code has errors, the first thing you should do is put all the code inside the sub into a try catch clause:
Private Sub OperateExcel()
Try
'the rest of the code here'
Catch ex as Exception
MsgBox(ex.tostring)
End Try
End Sub
Then at least you'll find out if this code works at all. After that comes the important part, comparing what this code does to what you want it to do.
A simple way to start is to write comments into the code. One comment for each step, and then fill in the code bits doing each step.
My advice is free, and you may get what you paid for.
|
|
|
|