|
Hi, dear all,
I create a project using VB.net in 2005, I need to list a set of file path to a datagridview table. I put horizontal scrollbar as auto, everything is fine.
Now client complains that when the file path is too long, they cannot see the file name, they wish if the file path is too long, he want to see the last text (string end) than the first text(begining of the string) of the file path.
How can I achieve this?
Thanks!
|
|
|
|
|
Well, the first thing I thought of was custom formatting the string on render and just displaying the filename, maybe with an ellipses (...) before the name, like this: "...\SomeFile.txt".
But, then you've got to take into consideration whether the user is going to click on this and be able to select that data to do something with it or edit it in place.
|
|
|
|
|
Dave,
Thanks for reply,
The file path string is just for display purpose.
|
|
|
|
|
You could use the CellFormatting event to alter the way the cell shows the data, or to alter the data that gets displayed.
And you could shorten the file path any way you want, maybe as suggested here[^].
Finally you can still get a ToolTip for the cell in another way if you want, see the CellToolTipTextNeeded event.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc,
Thanks for give me the good suggestion.
|
|
|
|
|
Hi,
i searched around the Net and Code Project for some existing parser, but so far unsuccessful.
What I want to do is parse a Visual Basic .FRM (form) file and extract the control names defined within. I also want to determine if there are nested controls within.
If possible, convert the listing and nested information into some format that can be easily worked with by other tools - like XML or some identifiable tree structure.
For example (MyForm.frm):
Begin Control1Lib.Cntrl1 MyCntrl1
Height = 555
Left = 0
...
Begin Control2Lib.Cntrl2 MyNestedCntrl2
Height = 375
...
BeginProperty Font {aldfladlf-lsl-ladsjlfj}
...
EndProperty
End
End
Then the parser could tell me I have two controls (MyCntrl1, MyNestedCntrl2) and SHOW that MyNestedCntrl2 is nested inside MyCntrl1.
Examples:
Level ControlName
1.0 MyCntrl1
1.1 MyNestedCntrl2
2.0 MyCntrl2
2.1 Nested2_1
2.2 Nested2_2
3.0 MyCntrl3
3.1 Nested3_1
3.1.1 Nested3_1_1
3.1.1.1 Nested3_1_1_1
...
XML example:
<MyCntrl1>
<MyNestedCntrl2>
</MyNestedCntrl2>
</MyCntrl1>
<MyCntrl3>
<Nested3_1>
<Nested3_1_1>
<Nested3_1_1_1>
</Nested3_1_1_1>
</Nested3_1_1>
</Nested3_1>
</MyCntrl3>
I am sure this is somewhere out on the Net where I can download, so can you point me to the place to research?
Thank you much!
JJ
|
|
|
|
|
First, not to piss on your parade route, but WHY? VB6 is long since dead and not supported by anyone any more. What tools do you think are going to want to know this stuff when nobody is developing new tools for VB6?
Second, the FRM file is just a text file. There really isn't any parser out there that I can find (probably because VB6 has been outdated for 10 years now) Writing one should be pretty straight forward.
|
|
|
|
|
True that, and that's basically why i want to achieve what I'm asking...
I have some legacy application and there are some 3rd party controls that have long since been retired. I want a method to identify all the controls in my application and determine what needs attention.
My take on this would be to write my own simple parser to:
1. search .FRM for "Begin" <type> <control variable name>
2. for each "Begin", push onto a stack (var name, unique id, level++)
3. for each "End", pop from stack, print info (id++, level--, var name)
(you can see my c++ tendencies)
It seemed quicker to ask the community before setting off and writing.
Cheers.
|
|
|
|
|
The logic seems reasonable. I'd start writing because you'll probably spend just as much effort to find something that does it for you.
|
|
|
|
|
How can I log into a website. Lets take as an example, logging into codeproject.com. I have:
Dim objIE
Set objIE = WScript.CreateObject("InternetExplorer.Application")
objIE.Navigate "http://www.codeproject.com"
objIE.Visible = true
While objIE.Busy = true
Wend
objIE.Document.All("Email").Value = "brinasas@yahoo.com"
objIE.Document.All("Password").Value = "xxxxxx"
objIE.Document.All("button").Click
'Dim Wsh : set Wsh = CreateObject("WScript.Shell")
'Wsh.SendKeys "{ENTER}"
But the above script gives me an error. Any feedback anyone can give me will be
greatly appreciated.
|
|
|
|
|
Why is it noone ever thinks the error message is an important detail to put into a post concerning the non-functioning of a piece of code?
|
|
|
|
|
The error says:
Line: 10
Char: 1
Error: Object required: 'Document.All(...)'
Code: 800A01A8
Source: Microsoft VBScrpt runtime error
Line 10 is this line:
objIE.Document.All("Email").Value = "brinasas@yahoo.com"
Any response you can give me will be greatly appreciated.
|
|
|
|
|
That would be because Document.All("Email") didn't return an object. This means you cannot set the Value property of an object that doesn't exist.
You may want to check to see if that code returned an object before you try and use it.
Dim c
Set c = objIE.Document.All("Email")
If c Is Nothing Then
' A control called "Email" doesn't exist in the page!
' Handle this condition appropriately.
Else
c.Value = "blah@somewhere.net"
End If
|
|
|
|
|
Read This[^], it may help.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
|
This may be more of printer issue than a VB.Net issue.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Pick a single forum, don't ask more than once.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Hi;
Please help me in VB6 programming,
for: [On/Off] 2#LEDs by 1#USB port.
source code & simple Electronic Interface.
Thans a lot.
ufo4444p239@yahoo.com
|
|
|
|
|
Not going to happen.
First, VB6 is dead and has been for quite some time. Move to VB.NET.
Second, Google for "VB6 control LED USB" and see what you get. You can do this yourself because it's probably going to be the very first thing anyone else is going to do for you, or not.
|
|
|
|
|
If he pays enough, he will get also VB6 support. I will call it not a fee, but a compensation for pain and suffering.
I cannot remember: What did I before google?
|
|
|
|
|
No help will be coming, VB6 is no longer used or supported.
If you are being taught this, and have paid a fee, demand your money back, right now!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
je veux savoir comment je peux passer des éléments sélectionnes dans un listbox à un datagrid
|
|
|
|
|
This is an English speak site. This is what Google Translate thinks you said:
I want to know how I can pass the selected items in a listbox to a datagrid
The easiest way to do it would be if you bound the datagridview to the same source you bound your ListBox to.
If not, then you'll have to iterate over the items in the listbox and add them to the rows or a manually setup DataGridView or to a DataTable object and bind your DGV to that.
|
|
|
|
|
I want to read excel sheet cells.
I have written the following code in Visual Basic 2005 in single desktop environment with no net connectivity:
Public Class Form1
Public xl As New Excel.Application
Public xlsheet As Excel.Worksheet
Public xlwbook As Excel.Workbook
Public j As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox("Hello")
xlwbook = xl.Workbooks.Open("D:\sample.xls")
xlsheet = xlwbook.Sheets.Item(1)
TextBox1.Text = xlsheet.Cells(2, 1) ' row 2 col 1
TextBox2.Text = xlsheet.Cells(2, 2) ' row 2 col 2
xl.ActiveWorkbook.Close(False, "D:\sample.xls")
xl.Quit()
End Sub
End Class
I am getting the errors as:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Vbc.exe /noconfig /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.Data,System.Drawing,System.Diagnostics,System.Windows.Forms /nowarn:42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 /rootnamespace:VBCheck /doc:obj\Debug\VBCheck.xml /define:"CONFIG=\"Debug\",DEBUG=-1,TRACE=-1,_MyType=\"WindowsForms\",PLATFORM=\"AnyCPU\"" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll,C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Deployment.dll,C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll,C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll,C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll,C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /main:VBCheck.My.MyApplication /debug+ /debug:full /out:obj\Debug\VBCheck.exe /resource:obj\Debug\VBCheck.Form1.resources /resource:obj\Debug\VBCheck.Resources.resources /target:winexe Form1.vb Form1.Designer.vb "My Project\AssemblyInfo.vb" "My Project\Application.Designer.vb" "My Project\Resources.Designer.vb" "My Project\Settings.Designer.vb"
error BC30002: Type 'Excel.Application' is not defined.
error BC30002: Type 'Excel.Worksheet' is not defined.
error BC30002: Type 'Excel.Workbook' is not defined.
How to get rid of this error?
|
|
|
|
|