|
Microsoft Office Interop has loads of good stuff. Justin's example is just the beginning of it.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
I created an SDI application with one form and one ListView control and loaded the data, showing by Groups, here is the code:
Me.ListView1.BeginUpdate()
With Me.ListView1
.View = View.Details
.Items.Clear()
.Columns.Clear()
.MultiSelect = False
.FullRowSelect = True
.GridLines = True
.ShowGroups = True
End With
If Me.ListView1.Columns.Count = 0 Then
Me.ListView1.Columns.Add("Request", 100, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Description", 200, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Date", 75, HorizontalAlignment.Center)
Me.ListView1.Columns.Add("Approver", 100, HorizontalAlignment.Left)
Me.ListView1.Columns.Add("Status", 100, HorizontalAlignment.Left)
End If
While (Reader.Read)
dt = CDate(Reader("RequestDate"))
ReqDate = String.Format("{0 }", dt)
Me.ListView1.Groups.Add(Reader("RequestedBy"), Reader("RequestedBy"))
Dim listItem As New ListViewItem(Reader("RequestNumber").ToString)
listItem.Group = Me.ListView1.Groups(Reader("RequestedBy").ToString)
listItem.SubItems.Add(Reader("OrderDescription").ToString)
listItem.SubItems.Add(ReqDate)
listItem.SubItems.Add(Reader("NextApprover").ToString)
listItem.SubItems.Add(Reader("StatusDescription").ToString)
Me.ListView1.Items.Add(listItem)
End While
Me.ListView1.EndUpdate()
The results were as expected, but when I added this form to my MDI app, where it is supposed to be used, it does not display the groups, but the rest of the column data is displayed fine. I have tried everything I knew off but no luck.
I will greatly appreciate if someone could offer any suggestions. Thanks.
|
|
|
|
|
Faruk Ansari wrote: The results were as expected, but when I added this form to my MDI app, where it is supposed to be used, it does not display the groups, but the rest of the column data is displayed fine. I have tried everything I knew off but no luck.
Are XP Visual Styles turned on in this project?? If not, the groups will not render. Grouping is only supported under Windows XP and above and only when EnableVisualStyles is turned on.
|
|
|
|
|
Dave,
Thank you so much for your help. I bet that is the reason because I am using Sub Main in a code file instead of a Form as the Startup Object. Since my posting I created another MDI application to test, this one uses a Form as the Startup Object and the EnableVisualStyles is turned on and I am able to see the Groups. I would never have thought about that. Thanks again.
Sincerely...Faruk
|
|
|
|
|
It's documented in the Groups Property[^] docs on MSDN and in the MSDN Help with Visual Studio. i know it's not the most obvious place to see this...
But, when you run into a problem like this, start reading the docs on each property and method that you're using and look for these little quirks, especially in the Notes and Exceptions sections. Stuff like this bites people all the time, even the pros at Microsoft.
|
|
|
|
|
Does anyone out there know how to save an image directly from a webbrowser control once a page is loaded?
I am not looking for a way to "re-download" the image based on the src value, because I can do that.
I was thinking more along the lines of copying the image from the webbrower control into the clipboard and then saving it.
The reason for this is, some sites only alow you to view thier pictures, when you are browsing thier site, so if you download the image directly, you get a different image.
|
|
|
|
|
Justin,
No, I don't know of a way to save just a particular image, but you could save the whole webpage, as in this code[^].
|
|
|
|
|
Thanks, I will download it and check it out.
|
|
|
|
|
|
Hi All,
I am developing project in MS-Access with VBA.
In MS-Access I have 1 form , which has 1 command Button.
For me, When I click the button, it should take and read texfile from path c:
and i need to go through loop until all the lines are completed in that file.
So I need to Read the textfile one by one line and store that particular line in string and in that string i have to search whether that line starts with 1 or 2. If it starts with 1 i have to give different command or if its starts with 2 then different command.
Likewise i need to check for all the lines in that textfile.
I tried it in different way, but didnt help. Kindly help me. Its very urgent.
Thanks in advance.
Regards,
|
|
|
|
|
here is C# example, use any converter for VB
string[] lines = File.ReadAllLines( <FILEPATH> );
then make a loop that will check every line
hope this will help
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Try this...
<br />
Dim FILE_NAME As String = "C:\test.txt"<br />
Dim tmpLine As String = ""<br />
<br />
<br />
If System.IO.File.Exists(FILE_NAME) = True Then<br />
<br />
Dim objReader As New System.IO.StreamReader(FILE_NAME)<br />
<br />
Do While objReader.Peek() <> -1<br />
<br />
tmpLine = objReader.ReadLine()<br />
If Mid(tmpLine, 1, 1) = "1" Then<br />
' Your code for command 1<br />
ElseIf Mid(tmpLine, 1, 1) = "2" Then<br />
' Your code for command 2<br />
Else<br />
' Your code for anything else<br />
End If<br />
Loop<br />
<br />
<br />
<br />
Else<br />
<br />
MsgBox("File Does Not Exist")<br />
<br />
End If<br />
|
|
|
|
|
Hi Everyone,
I wish to segregate my datatable based on the value of a particular column. Consider the following example:
My data table consists of the following records:
City | Name | Surname| Tel no
Mumbai | John | Smith | 111111
Mumbai | Rick | Carter | 444444
Chennai| Raj | D | 555555
Now what i wish to do is fetch the records having city as 'Mumbai' into one table and records having city as 'Chennai' into another table.
However, i am not sure how many such cities will be present in the main table or what their names will be.
Is it possible?...Kindly suggest something. I really need it urgently.
Any help is appreciated.
Thanking all of you in Anticipation.
Siddy
|
|
|
|
|
research dataview
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|
|
Oahhh... stop calling for urgent help, everything is urgent here...
You can use the Select() method of your datatable, or filter the result on your datasource
DataRow[] drMumbai = DataTable.Select("City = 'Mumbai'", "Name");
or change the select query on your datasource so that it contains WHERE (City = 'Mumbai')
Goog luck
|
|
|
|
|
Thank you for replying.
However, i dont think you really understood what i want.
I do know the use of the Select() function on a datatable,
but if you read carefully, the problem is that i do not know if my city is going to be 'Mumbai'or anything else, so i cannot hard code it. Similarly i do not know how many such DISTINCT cities will be returned.
I am looking for something analogous to a 'GROUP BY' clause in SQL.
So that i can fetch the COUNT of the DISTINCT cities returned and then create those many different datatables, each with a different city.
Can you help me with this?
Thanks in advance.
Siddy
|
|
|
|
|
So why not just fetch this value from the database??
SELECT COUNT( DISTINCT( CityName ) ) AS DistinctCities FROM myTable
|
|
|
|
|
Thank you for replying.
Although i might fetch the COUNT of distinct cities from the
database, how am i going to segregate records after fetching them into the data table. I will definately know how many distinct cities exist, however i am unable to find a way to filter out those records depending upon city names, into seperate tables. (Again hard coding of city names to segregate records is not possible!)
I was just trying to know if there exists a pre-defined function to do such a thing.
I guess i will have to mull over it to find a logic of my own.
Thank you all for taking the time out to think over it though.
Siddy
|
|
|
|
|
This is too easy. If you can get the count of DISTINCT cities, you can just remove the COUNT function from the exact same SQL statement to get the entire list of distinct city names.
|
|
|
|
|
hi guys;
it s a little difficult ;idont wanna get the Max value of all but Max-values between the blocks.
this code below serve to get the max value
<br />
For zahl = 0 To Intens_Array.GetUpperBound(0)<br />
If Intens_Array(zahl) = 0 Then<br />
Max = 0<br />
Else<br />
If Max < Intens_Array(zahl) Then<br />
Max = Intens_Array(zahl)<br />
End If<br />
End If<br />
Next<br />
thats easy; but what i want is to get the Max value between each block of zero-values;
look here: i have an array with the values like
00000041932321459000000076384600000323453200000
my question is, how could i get the max VALUES whithin each block and his index in this arry for this example will be like:
9-->index:17
8-->index:28
5-->index:40
i hope i was clear;
so let me know pls )
thx all
|
|
|
|
|
<br />
Dictionary<integer, integer=""> dictMaxAndIndex = new Dictionary<integer, integer=""><br />
For zahl = 0 To Intens_Array.GetUpperBound(0)<br />
If Intens_Array(zahl) = 0 Then<br />
dictMaxAndIndex.Add(Max, zahl)<br />
Max = 0<br />
Else<br />
If Max < Intens_Array(zahl) Then<br />
Max = Intens_Array(zahl)<br />
End If<br />
End If<br />
Next<br />
</integer,></integer,>
I added a dictionary of two integers. The first keeps the max value, the second it's index... You can now loop through the dirctionary to get it's values...
|
|
|
|
|
first thx for this help;,so i try it but it doesnt work?? this my code:
<br />
Dim Intens_Array() As Double = {0, 0, 0, 0, 0, 0, 2, 3, 9, 8, 1, 4, 5, 0, 0, 0, 0, 0, 0, 0, 5, 4, 9, 4, 8, 4, 3, 0, 0, 0, 0, 0, 0, 5, 4, 3, 2, 2, 6, 0, 0, 0}<br />
Dim Intens_Array1() As Double<br />
Dim Max As Integer = 0<br />
Dim zahl, zahl1 As Integer<br />
Dim Index As Integer = 0<br />
Dim dictMaxAndIndex As New Dictionary(Of Int16, Int16)<br />
<br />
'Dictionary(dictMaxAndIndex = New Dictionary)<br />
For zahl = 0 To Intens_Array.GetUpperBound(0)<br />
If Intens_Array(zahl) = 0 Then<br />
dictMaxAndIndex.Add(zahl, Max)<br />
Max = 0<br />
Else<br />
If Max < Intens_Array(zahl) Then<br />
Max = Intens_Array(zahl)<br />
End If<br />
End If<br />
Next<br />
For zahl1 = 0 To dictMaxAndIndex.Count - 1<br />
Console.WriteLine("For key = ""3"", value = {0}.", _<br />
dictMaxAndIndex("3"))<br />
Next<br />
System.Console.ReadLine()<br />
what i want is to put the max values with her indexes in this dictionary ; no zeros!!zeros have to be ignored. so like, hope its clearly??
thx for help.
|
|
|
|
|
'Dictionary(dictMaxAndIndex = New Dictionary)
For zahl = 0 To Intens_Array.GetUpperBound(0)
If Intens_Array(zahl) = 0 Then
If (Max > 0)
dictMaxAndIndex.Add(zahl, Max)
Max = 0
Else
If Max < Intens_Array(zahl) Then
Max = Intens_Array(zahl)
End If
End If
Next
For zahl1 = 0 To dictMaxAndIndex.Count - 1
Console.WriteLine("For key = ""3"", value = {0}.", _
dictMaxAndIndex("3"))
Next
System.Console.ReadLine()
|
|
|
|
|
I am working with a word plugin. It checks all words in a document against a dictionary. After a check some words are coloured depending on if they are ambigues or not recommended. A right-click on a coloured word opens a popup with a list of recommended words. The user clicks on a recommended word in the popup window and the coloured word will switch to the recommended and the colour will change. The user can press ctrl+z and undo the change. I have to monitor ctrl+z and put the right colour on the word. How do I monitor ctrl+z in a word document?
|
|
|
|
|
Hi,
I am using webclient to download file from another location.
I am downloading swf file.
while downloading swf file it shows size of file less than the origional size.
I want to download swf file that has same size that of origional.
Thanks
|
|
|
|
|