|
I'm not 100% on this, but I'm pretty sure you can do this through WMI.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed.
Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Coo
|
|
|
|
|
Your should try Googling your question[^]before you post them here.
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Thanks Steve, that was brilliant.
|
|
|
|
|
In my Application VB.Net and I am going to cerate combo box,
It is behavior like a windows O.S using run command.
Combo Box is having some data many rows,
If user type “c” it is come listed “c” order word
Franics K Antony
|
|
|
|
|
Check out the articles for the autocomplete comboboxes.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed.
Lotus Notes is a conspiracy by the forces of Satan to drive us over the brink into madness. The CRC-32 for each file in the installation includes the numbers 666." Gary Wheeler
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Coo
|
|
|
|
|
Hi ,
i want this 'Datatype' property as combobox in propertygrid .
-- Datatype
-- Date (Sub Property)
-- Text (sub Property)
-- Number (sub Property)
--Format -
On selecting type of sub-property in combobox the things should be appear in next property ' Format '
if Date is selected ,' dd-mm-yyyy ' should appear .
If Text is selected , nothing should appear.
if NUmber is selected,' 12345 ' should appear in Format property .
Vb8.0
|
|
|
|
|
Try this format
dd-MMM-yyyy
Franics K Antony
|
|
|
|
|
Try setting your Property DataType as an Enum. For example :-
Enum DataTypes<br />
Date=1<br />
Text=2<br />
Number=3<br />
End Enum<br />
<br />
Property DataType As DataTypes<br />
Get<br />
'Your code here<br />
End Get<br />
Set(ByVal Value As DataTypes)<br />
'Your code here<br />
End Set
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Thanks
Here it's not taking Date as a type of enum . Rising error 'at the place of Date
" Statement cannot appear within a enum body " .
|
|
|
|
|
Sorry, the example should have read :-
Enum DataTypes<br />
[Date]=1 '<--- Note the square brackets<br />
Text=2<br />
Number=3<br />
End Enum<br />
<br />
Property DataType As DataTypes<br />
Get<br />
'Your code here<br />
End Get<br />
Set(ByVal Value As DataTypes)<br />
'Your code here<br />
End Set
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
Thanks ,
Now i am able to show the Datatypes .
Now if i select the DataType "Date" then in Text property of Propertygrid , I want to show the datetimepicker .If not i want to show nothing .
For this i used ....
Public Class MyDate<br />
Inherits UITypeEditor<br />
Dim CustomDate As DateTimePicker<br />
Public Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal provider As System.IServiceProvider, ByVal value As Object) As Object<br />
CustomDate = New DateTimePicker<br />
CustomDate.Format = DateTimePickerFormat.Custom<br />
CustomDate.CustomFormat = "d-MMM-yyyy"<br />
CustomDate.ShowUpDown = True<br />
CustomDate.Show()<br />
Return MyBase.EditValue(context, provider, value)<br />
End Function<br />
Public Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle<br />
Return UITypeEditorEditStyle.DropDown<br />
End Function<br />
it is showing the dropdown ,but not getting the Datetimepicker .
After selecting the date i want to show in Text Property .
For this what i have to follow ??????????
VB 8.0
|
|
|
|
|
Does any body know how to change to height of the textbox?
Do we have to use any API's to do that?
Any idea or link??
|
|
|
|
|
Hello,
There is no option to change the height of TextBox in .Net. But,
there are other options using which you can change the height.
1. You can set the 'MultiLine' property to True. However, this will
cause the text to wrap into multiple lines.
2. Another option is to increase the font of the Textbox. This will
automatically set the height of the Textbox.
I hope this answers your query.
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Hello every one
I am having a VB 2005 application and using “DrawString” to print a bill.
I want is to print the amount in floating point format, with decimal point like “56.00” instead of “56”
I am using floating points variables but when I am changing it into string, to sent it for printing “.00” will is lost
Also I wanted the numeric columns to be right aligned which I am not able to do
Can any one give me a idea how to do it..
Regards
Nishkarsh
|
|
|
|
|
Convert the value to a string format in the DrawString Method:
DrawString(Format(value,"0.00"),...)
This will ensure the format you want.
I don't speak Idiot - please talk slowly and clearly
|
|
|
|
|
Thanks for ur help. It is working.
Any idea how to align the text to right?
The numbers I am printing for amount should be right aligned.
In case of DrawString i can just tell the starting, i.e. only the left most point. How do I do that?
|
|
|
|
|
To align the text you have to set up a StringFormat object:
Dim sf As New StringFormat<br />
sf.Alignment = StringAlignment.Far<br />
sf.LineAlignment = StringAlignment.Center<br />
<br />
DrawString(Format(value,"0.00"),fnt, Brushes.Black,rectF,sf)
(I cant remember if the LineAlignment and Alignment properties are around the right way but a little trial and error will sort this out.)
Cheers
I don't speak Idiot - please talk slowly and clearly
|
|
|
|
|
To format a number as money use: YourDecimalOrFloatOrDoubleOrWhatEver.Tostring("F")
If you mean columns in a datagrid, you should explore the possibilities of the TableStyle.
My advice is free, and you may get what you paid for.
|
|
|
|
|
|
I am not very clear about what do u want to know, i will tel u what i got out of your question
1 U want to have a right click event.. If so then every object has a right click event handler associated you can go to the codes and select the object and then right click the event handler will come
2 U want to have a menu coming on right click of an object then use ContextMenuStrip
Hope this helps u
Good luck
|
|
|
|
|
You need to add an event handler for MosueDown to for your control, then test to see which mouse button is pressed. For example:-
Private Sub myControl_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles myControl.MouseDown<br />
If e.Button = Windows.Forms.MouseButtons.Right Then<br />
'Your code here<br />
End If
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
it is possible,,running Reporting services2005(rdl) from VB aplikasi Without IIS??
|
|
|
|
|
Colleagues,
Are there controls for VB6 that have the visual properties of a shape and line controls, and also have better mouse support, so that they can be made more interactive?
I’m writing an application that displays a process diagram. I’d like to add things like ToolTips and to make some elements on the diagram clickable.
I know that I can put a label on a shape and it would provide the mouse support that I need. It would work for square-ish shapes, but it doesn’t work well for circles.
- Nick
|
|
|
|
|
This is more of a VB thing because I am planning to execute it inside of the SQL 2000 DTS package but I am testing it in VB.Net app. It has been a while since I've worked with XML and I got stumbled with a simple one here!!
I just need to read Detail/DT and Detail/Accounts XML in the loop - I don't think my XPath is correct.
Somehow data that I read is not pasted into Excel document. What am I doing wrong. Please help.
Many Thanks!!!
<code>
<report xmlns="_x0031_000ImprAccount" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="_x0031_000ImprAccount " name="10Impr">
<table1>
<detail_collection>
<detail dt="2008-01-01T00:00:00" accounts="203" />
<detail dt="2008-01-02T00:00:00" accounts="219" />
<detail dt="2008-01-03T00:00:00" accounts="224" />
</detail_collection>
</table1>
</report>
</code>
xlapp = CreateObject("Excel.Application")
xlapp.Workbooks.Add()
xlapp.ScreenUpdating = False
DateMsg = "Generated on - " + FormatDateTime(Now(), 0)
' Load the xml file
strFileName = "C:\test.xml"
oDoc = CreateObject("MSXML2.DOMDocument")
oDoc.async = False
oDoc.validateOnParse = True
oDoc.Load(strFileName)
Detail = "Detail"
If oDoc.parseError.errorCode = 0 Then
R = 0
C = 0
xPath = "//Detail_Collection"
DetailCollection = oDoc.selectNodes(xPath)
Dim bookTitle, bookAuthor
For Each Detail In DetailCollection
DetailAccount = Detail.SelectSingleNode("Detail[@Accounts]").text ' Not sure if XPath is correct here..
xlapp.ActiveCell.Offset(R, C).Value = DetailAccount ' Copy to Excel
Next
End If
'Save Excel File
Dim filo
Dim Awkbk
Dim savefile
filo = "C:\testexcel.xls"
Awkbk = xlapp.ActiveWorkbook
savefile = Awkbk.SaveAs(filo, -4143, , , , , )
<code></code>
|
|
|
|
|
Although this may not be the answer you were looking for, let me tell you about the solution I use. I also needed to create excel reports on a regular basis, and I was on the edge of despair, because creating data directly into an Excel file just wouldn't work. I found three different methods suggested by Microsoft and many similar ones from coders all over the web, but could not get anything to work.
In the end someone here on the forum explained this method to me, that is slightly more clumsy to build at first, but will give you much more control over the output afterwards, is a lot less sensitive to (MS Excel) version problems, and can be easily adapted to work from any programming language:
First create an Excel file (in excel) that looks the way you want it to look. Next save this Excel file as xml. And last open this xml file with .NET Studio.
Finally (or alternatively) you can adapt the following function to your needs (the example is from one of my apps, so there is some stuff in there you may want to take out):
Public Function DatasetToExcel(ByVal ds As DataSet, ByVal ExcelPath As String)<br />
If File.Exists(ExcelPath) = True Then<br />
If MsgBox("Tiedosto on jo olemassa. Haluatko korvata sen?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then<br />
File.Delete(ExcelPath)<br />
Else<br />
ExcelPath = InputBox("Muuta nimi: ", "Tiedosto olemassa", ExcelPath)<br />
End If<br />
End If<br />
Dim doc As New StreamWriter(ExcelPath) 'use .xls even though its an xml file<br />
Try<br />
Dim startExcelXML As String = ""<br />
startExcelXML &= "<xml version="">"<br />
startExcelXML &= vbNewLine & "<workbook xmlns="" urn:schemas-microsoft-com:office:spreadsheet="" hold=" /"> startExcelXML &= vbNewLine & Microsoft.VisualBasic.Chr(10) & "" + " xmlns:o=""urn:schemas-microsoft-com:office:office"""<br />
startExcelXML &= vbNewLine & "xmlns:x=""urn:schemas- microsoft-com:office:" + "excel"""<br />
startExcelXML &= vbNewLine & "xmlns:ss=""urn:schemas-microsoft-com:" + "office:spreadsheet"">"<br />
<br />
'write the styles tags that format the data and cells properly<br />
startExcelXML &= vbNewLine & "<styles>"<br />
<br />
startExcelXML &= vbNewLine & " <style ss:id="" default="" ss:name="" normal="">"<br />
startExcelXML &= vbNewLine & " <alignment ss:vertical="" bottom="" />"<br />
startExcelXML &= vbNewLine & " <borders />"<br />
startExcelXML &= vbNewLine & " <font />"<br />
startExcelXML &= vbNewLine & " <interior />"<br />
startExcelXML &= vbNewLine & " <numberformat />"<br />
startExcelXML &= vbNewLine & " <protection />"<br />
startExcelXML &= vbNewLine & " </style>"<br />
<br />
startExcelXML &= vbNewLine & "<style ss:id="" colheader="">"<br />
startExcelXML &= vbNewLine & "<alignment ss:horizontal="" center="" ss:vertical="" bottom="" />"<br />
startExcelXML &= vbNewLine & "<font x:family="" swiss="" ss:size="" 8="" ss:bold="" 1="" />"<br />
startExcelXML &= vbNewLine & "<interior ss:color="" #c0c0c0="" ss:pattern="" solid="" />"<br />
startExcelXML &= vbNewLine & "</style>"<br />
<br />
startExcelXML &= vbNewLine & " <style ss:id="" reg="">"<br />
startExcelXML &= vbNewLine & " <font x:family="" swiss="" ss:bold="" 0="" />"<br />
startExcelXML &= vbNewLine & " </style>"<br />
<br />
startExcelXML &= vbNewLine & "</styles>"<br />
'write the header to the file<br />
doc.WriteLine(startExcelXML)<br />
'write one sheet per table<br />
For Each tab As Data.DataTable In ds.Tables<br />
Dim sheetname As String = "<worksheet ss:name="<br mode=" hold=" /"> sheetname &= Microsoft.VisualBasic.Chr(34)<br />
sheetname &= tab.TableName.Trim<br />
sheetname &= Microsoft.VisualBasic.Chr(34)<br />
sheetname &= ">"<br />
doc.WriteLine(sheetname)<br />
doc.WriteLine("<table>")<br />
'write the column headers<br />
doc.WriteLine("<row>")<br />
For Each col As DataColumn In tab.Columns<br />
doc.Write("<cell ss:styleid="" colheader=""><data ss:type="" string="">")<br />
doc.Write(col.ColumnName)<br />
doc.WriteLine("</data></cell>")<br />
Next<br />
doc.WriteLine("</row>")<br />
'write the table<br />
For Each row As DataRow In tab.Rows<br />
doc.WriteLine("<row>")<br />
'Dim i As Integer<br />
For i As Integer = 0 To tab.Columns.Count - 1<br />
doc.Write("<cell ss:styleid="" reg=""><data ss:type="" string="">")<br />
doc.Write(row.Item(i))<br />
doc.WriteLine("</data></cell>")<br />
Next<br />
doc.WriteLine("</row>")<br />
Next<br />
doc.WriteLine("</table>")<br />
doc.WriteLine("</worksheet>")<br />
Next<br />
doc.WriteLine("</workbook>")<br />
doc.Close()<br />
Catch Ex As Exception<br />
doc.Close()<br />
EC(Ex, "RV, DatasetToExcel")<br />
End Try<br />
End Function</xml>
Hope this helps you on your way.
Johan
My advice is free, and you may get what you paid for.
|
|
|
|