|
Paramu1973 wrote: Is it possible...?
AFAIK no!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yes it's possible.
Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
'Populate your report data etc.
If PrintDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
rptDocument.PrintOptions.PrinterName = PrintDialog.PrinterSettings.PrinterName
rptDocument.PrintToPrinter(PrintDialog.PrinterSettings.Copies, False, 1, 1)
End If
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
I don't want users can choose any tab when they click on tabheader.How to do this?Please help me!!!!
|
|
|
|
|
Here is a C# code that would do a similar thing. Changing it to VB should not be a big task IMO.
bool CanSelect = false;
void tabControl1_Selecting(object sender, TabControlCancelEventArgs e) {
e.Cancel = !CanSelect;
CanSelect = true;
}
Now, set the CanSelect variable to true when you want the selection to happen.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
The VB.Net for d@nish's code might be something like:
Private Sub TabControl1_Selecting(ByVal sender As Object, ByVal e As System.Windows.Forms.TabControlCancelEventArgs) Handles TabControl1.Selecting
e.Cancel = Not CanSelect
End Sub
i.e. If CanSelect is True then .......... Don't cancel the TabControl1_Selecting event
If CanSelect is False then ......... Do cancel the TabControl1_Selecting event
|
|
|
|
|
Hello,
I am trying to make a small app to interact with Tumblr.com.
The API information page is here:
http://www.tumblr.com/docs/api
It outputs XML which i am not familiar with....yet.
What i want to know is how would i tell a vb app to download this output and what sort of variable should i keep it in to work with? Is string appropriate?
The ANZAC
|
|
|
|
|
Imports System
Imports System.IO
Imports System.Net
Imports System.Xml
Module Module1
Sub Main()
'Address of URL, just a random user
Dim URL As String = "http://harumacchi.tumblr.com/api/read"
' Get data
Dim client As WebClient = New WebClient()
' Read an print to console
Dim reader As StreamReader = New StreamReader(client.OpenRead(URL))
Dim str As String = ""
Do While reader.EndOfStream = False
str = reader.ReadLine()
Console.WriteLine(str)
Console.ReadKey()
Loop
' load as document
Dim xmldoc As XmlDocument = New XmlDocument()
xmldoc.Load(client.OpenRead(URL))
For Each node As XmlNode In xmldoc.ChildNodes
Console.WriteLine(node.Name)
Console.ReadKey()
Next
' read as xml
Dim xmlreader As XmlTextReader = New XmlTextReader(client.OpenRead(URL))
Do While xmlreader.Read()
If xmlreader.NodeType = XmlNodeType.Element Then
Console.WriteLine(xmlreader.LocalName)
Console.ReadKey()
End If
Loop
End Sub
End Module
I personally prefer XmlDocument but you could also use XmlTextReader.
|
|
|
|
|
Thanks. I'm not sure exactly how to work with this though.
If you are willing to help more here I have further questions. Alternatively I can make a new thread.
For instance, how would i then get certain bits of information about each post?
I gather the For Each loop can be used to probe the nodes, but how would i find the id or link for each post using this loop?
|
|
|
|
|
I'm a bit lost now.
Don't you understand the tumbler/api xml or are you confused with the XmlDocument class?
|
|
|
|
|
I don't really understand how to use the xml document, how to look through the nodes etc and extract the information i want.
|
|
|
|
|
XML Specification
In short, XML is a structured document, conforming to a schema.
Unfortunatly tumblr does not provide this schema (an XSD).
XmlDocument class
When you load an XML document into an XmlDocument instance it creates an XmlNode for every tag encountered and adds it as a childnode to its parent.
To traverse all nodes you start at the XmlDocument instance (it actually is an XmlNode itself!).
The HasChildren property indicates whether the node has children, you can iterate over the ChildNodes collection to get the nodes (which can also have children themselve).
A node also has an Attributes collection which contains things like name, ID, type etc. that you see in the tags of the XML file
To find specific node(s) there are methods like SelectNodes and SelectSingleNode. These methods use XPath syntax.
It's possible to generate a classmodel for use in your program. You need to locate XSD.exe, it's somewhere in "C:\Program Files\Microsoft SDKs\Windows\...\bin"
This utily can generate an XSD schema from an XML file and a .vb classfile from the XSD. So capture the output from http://(USER).tumblr.com/api/read, save as xxxx.xml and feed the file to XSD.exe. Then feed xxxx.xsd to XSD.exe in add the resulting xxxx.vb to your project.
Make sure that the captured XML contains all tags and attributes described on the tumblr/api page
|
|
|
|
|
Hi All,
Can someone please shed me a light on how to use VB/Batch Scripting to deploy applications as i am pretty new in this field. If anyone can attach a tutorial link will be great.
Many thanks in advance.
|
|
|
|
|
|
can anyone help me. i need to know how to create a combo box in datagrid in vb6.
|
|
|
|
|
sohil masani wrote: i need to know how to create a combo box in datagrid in vb6.
Using the MSFlexGrid? You'd drop a ComboBox on the Form, make it invisible, and show and reposition it when the cell gets the input-focus.
Alternatively, you could use the DataGridView from .NET using the Interop Toolkit[^]
I are Troll
|
|
|
|
|
thanks, but can you please write a source code for it.
|
|
|
|
|
Dear All,
I have a Form in VB .net 2005, on which a calender control is added to select date. I have added a crystal report also in my project. Now I want to add the date dynamically on the crystal report, i.e. if i select a date in calender control placed on the Form, the corresponding date should come/display on the crystal report ( whenever it is generated).
Hope I am clear.
Please note that I want to do this without creating any database to store the dates from the calender control.
Please suggest me how to do this asap.
Regards
R.S.
|
|
|
|
|
Use parameter field for your requirement, assign the parameter value in run time when you give the value by calender control
|
|
|
|
|
Hello Everybody.
it seems that ActiveDs.IADsComputer only accepts a GetObject using the WINNT provider and not the LDAP provider, Thus, the following code is not working, i tried to use it to enumerate computer accounts :
Dim RootDSE As ActiveDs.IADs
Dim oComputer As ActiveDs.IADsComputer
Dim DNC As String
Set RootDSE = GetObject("LDAP://rootDSE")
DNC = RootDSE.Get("defaultNamingContext")
Dim strADsPath As String
Dim ArrayofComputers() As String
Dim i As Integer
Const ADS_SCOPE_SUBTREE = 2
Dim objConnection As New ADODB.Connection
Dim objCommand As New ADODB.Command
Dim objRecordSet As ADODB.Recordset
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT ADsPath FROM 'LDAP://" & DNC & "' WHERE objectCategory='computer'"
Err.Clear
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
i = i + 1
ReDim Preserve ArrayofComputers(i)
strADsPath = objRecordSet.Fields("ADsPath").Value
Set oComputer = GetObject(strADsPath)
'the previous line throws an error
ArrayofComputers(i) = oComputer.Name
objRecordSet.MoveNext
Loop '
As you see, Set oComputer = GetObject(strADsPath) throws an error.
Do i need to revert to the Winnt provider or can i use another interface to get the computer object properties ?
Thanks.
|
|
|
|
|
I was able to bypass the problem by using
Dim oComputer As ActiveDs.IADs
and
oComputer.getinfo
oComputer.get("name")
oComputer.get("operatingSystem") or any other property
|
|
|
|
|
Public Class form_login
Private Sub btn_login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_login.Click
Get_Data()
End Sub
Public Sub Get_Data()
Dim qty As String
Dim cons As String
qty = "SELECT * FROM LOGIN WHERE USER_ID = @USER_ID AND PASSWORD = @PASSWORD"
cons = "Provider=Microsoft.Jet.OLEDB.4.0;data source=login.mdb"
Dim con As New OleDbConnection()
con.ConnectionString = cons
Dim com As New OleDbCommand()
com.CommandText = qty
Dim da As New OleDbDataAdapter()
da.SelectCommand.Parameters.AddWithValue("@USER_ID", txt_user_id.Text)--------error occurs on this line---- da.SelectCommand.Parameters.AddWithValue("@PASSWORD", txt_password.Text)
Dim dt As New DataTable
da.Fill(dt)
If dt.Rows.Count > 0 Then
Success.user_id = dt.Rows(0)("USER_ID").ToString
Me.Hide()
Success.Show()
End If
End Sub
End Class
Please help me out of thhis
|
|
|
|
|
Have you tried to change the constructor for the data adapter to;
Dim da as New OleDbDataAdapter(qty,cons)
Which would negate the need for con or com
OR
dim com as NewOleDbCommand
com.connection = con
Dim da as New OleDbDataAdapter(com)
Just think your referencing and constructors need a tidy up and the problem will be fixed.
|
|
|
|
|
Ur ans was CoOl But if fix the Data Adapter Then It will show another exception in
da.fill(dt) //Could not find file 'D:\Login\Login\Login\bin\Debug\login.mdb'.
|
|
|
|
|
See here
You should put your connectionsstrings in your app.config
|
|
|
|
|
Your data source property in the connection string is being locally referenced to the working directory.
You need to fully qualify the file name and path in this setting to ensure it is correctly found.
data source=login.mdb
change to
data source=x:\thefolderpath\morepath\login.mdb
|
|
|
|