|
Hi
I am using inputbox function to set or get the column names and row names of datagridview ,
1) when i call that function it shows the text of particular column or row ,If i make changes or not , then if i click OK it is showing the new name or or old name for datagridview col or row header .
2) When i click Cancel,Then the problem arises ,If there is string in the textbox of inputbox() also it is returning the length of string as 0,Which is setting the column Text or Row text as "" . So How can i maintain the text when the user presses cancel
Any Help in this ....
DVS
|
|
|
|
|
The most basic thing you can do, is simply check the length before you assign the new text to the row or column header.
Current code is probably something like:
NewHeaderText = InputBox("blablabla")<br />
MyDataSet1.Tables(0).Columns(0).ColumnName = NewHeaderText
The alternative would be:
NewHeaderText = InputBox("blablabla")<br />
If NewHeaderText.Length > 0 Then<br />
MyDataSet1.Tables(0).Columns(0).ColumnName = NewHeaderText<br />
End If
This way you catch an empty string, whether the user actually tried this, or whether he pressed cancel.
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
<br />
Dim iActiveCol As Integer = e.ColumnIndex<br />
Dim iActiveRow As Integer = e.RowIndex<br />
If iActiveRow = -1 Then<br />
If TypeOf sender Is DataGridView Then<br />
Dim sColumnName As String<br />
sColumnName = InputBox("Enter Column Name", "ColumnName", CType(ctr, DataGridView).Columns(iActiveCol).HeaderText)<br />
If sColumnName <> "" Then<br />
CType(ctr, DataGridView).Columns(iActiveCol).HeaderText = sColumnName<br />
CType(ctr, DataGridView).ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize<br />
Else<br />
' CType(ctr, DataGridView).Columns(iActiveCol).HeaderText = sColumnName '' Here it is erasing the text if i make it clear the text in inputbox and cancel . <br />
How to handle this one .<br />
<big> Exit Sub</big><br />
End If<br />
End If <br />
End If
Just observere the vb 6.0 adding a new tab There it is perfect how can i ge t that ??
For1206
|
|
|
|
|
The trick is to simply not touch the HeaderText at all, if the value of sColumnName is an empty string.
<br />
If sColumnName <> "" Then<br />
CType(ctr, DataGridView).Columns(iActiveCol).HeaderText = sColumnName<br />
CType(ctr, DataGridView).ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize<br />
Else<br />
Exit Sub<br />
End If<br />
Unless the code you posted is the only code in the sub, in that case you wouldn't even need
<br />
Else<br />
Exit Sub<br />
The code will simply run its course, never affecting the HeaderText of your column.
My advice is free, and you may get what you paid for.
|
|
|
|
|
I FRIENDS
I am receiving the following error on my select statement.
System.InvalidOperationException: Update unable to find TableMapping['Table'] or DataTable 'Table'.
Dim strDateLEvel1 As String
conn = New OleDb.OleDbConnection(connString)
strDateLEvel1 = "SELECT Format([tmpView.StartDate],""dd mmmm yyyy"") AS StartDate, Format([tmpView.StartDate],""dddd"") AS [Day], count(StartDateTime) AS MessageCount" & _
"FROM [SELECT Format([StartDateTime], ""dd mm yyyy"") as StartDate, Format([StartDateTime], ""dddd"") as Day FROM Messages]. AS tmpView" & _
"GROUP BY tmpView.StartDate" & _
"ORDER BY tmpView.StartDate DESC;"
Dim strpersonLevel1 As String
strpersonLevel1 = "SELECT participant AS StartedBy, count(Participant) AS MessageCount" & _
"FROM(participants)" & _
" WHERE(PArticipants.participant <> ""test3@ocs.lcs.local"")" & _
"GROUP BY participant;"
Dim str1 As String = "select * from messages;"
adp = New OleDb.OleDbDataAdapter(str1, conn)
'conn.Open()
Dim dt As New DataTable
Dim ds As New DataSet()
adp.Update(ds)
' AdvBandedGridView1.DataSource = ds
GridControl1.DataSource = ds
please help
Piyush Vardhan Singh
|
|
|
|
|
Piyush Vardhan Singh wrote: Dim dt As New DataTable
Dim ds As New DataSet()
adp.Update(ds)
This is nice. You created a new, empty DataSet, then you tried to Update the database from it. Then you set the DataSource of some Grid control to this empty database.
BTW, these are the only parts of your code snippet that do anything:
conn = New OleDb.OleDbConnection(connString)
Dim str1 As String = "select * from messages;"
adp = New OleDb.OleDbDataAdapter(str1, conn)
Dim ds As New DataSet()
adp.Update(ds)
GridControl1.DataSource = ds
The rest doesn't do anything at all, or isn't used in this snippet.
|
|
|
|
|
|
Did you consider the following options?
1) Uploading it to a File Hosting service and sending a single line download URL instead.
2) Renaming the .EXE as another acceptable file name extension.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
I am not to up on gmail but did you try zipping it
|
|
|
|
|
Wow - only in the VB forum.
Zip it, rename the zip ( gmail looks inside zips ) and send it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Usually, you would put the whole thing in a zip file with Winzip or some other zipping program and send that.
|
|
|
|
|
Thanks to all of you for spending time for my post
I have tried everything but could not happened anything , I tried it using ziped it and i removed the exe file but it says the folder has exe file may be because i want to send complete zip folder with bin,debug,release,all .vb files and eveything except exe file.
Thanks once again
|
|
|
|
|
Why is this post still here???????????
half the moderators propably died of shock the other half was admited into the local psyc ward
This one will go into my permanent collection right next to:
<br />
If (str = 3) then<br />
str = 3<br />
else<br />
str = str<br />
end if<br />
"All your base are belong to us..."
Mr. Cats (2110 A.D.)
|
|
|
|
|
Alex Feature
Why r u talking like this? what's your problem ???
If U don't want to give answer to my question then fine Ok!
But this is not righ way
|
|
|
|
|
dude chill
this is the dev forum not email support
"All your base are belong to us..."
- The Nameless One (2110 A.D.)
|
|
|
|
|
Anyways i have sorted out my problem with the help of GuyThiebaut sir,
Thanks to all who helped me and who criticized me
May You have a cool mind
With the best wishes
~V~
|
|
|
|
|
You are being sarcastic arent ya
"All your base are belong to us..."
- The Nameless One (2110 A.D.)
|
|
|
|
|
Here is a free file hosting site Clickety.
Upload your files/zip here.
You will be provided with a URL which you can then send to your client.
They will then be able to download the file.
Regards
Guy
You always pass failure on the way to success.
|
|
|
|
|
Respected GuyThiebaut
Your help is great
Thanks a lottttttttttt for your kind help
I will be greatful to you
|
|
|
|
|
You're welcome.
I realize it's nicer to get a helping hand than a slap in the face.
You always pass failure on the way to success.
|
|
|
|
|
We have a program that I do not have access to the code. What I would like to do is create my own program that can be initiated when a specific button click event occurs in the parent program. How could I make this happen if it is even possible. Also what tool can I use to find the specific event name for that button click when it occurs so I can make it happen?
TIA,
Brian
|
|
|
|
|
Process.Start
Oh, I see. If you don't have the parent program source, you can't do it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Have you considered not going through the parent program instead creating a whole new app that opens the parent using a totally transparent form and just making it look likt the buttons are part of the parent but really being contoled by yours
|
|
|
|
|
|
Nick Alexeev wrote: Have things changed significantly since that time? Well, VB6 haven’t changed of course.
No, it hasn't. It's just that the world has moved on to VB.NET and the XML classes built into the .NET Framework. Seriously, new tutorials for VB6 are very hard to come by.
|
|
|
|