|
No it's not.
ConfigurationSettings.AppSettings() does not look in the machine.config file anyway. It will look in the applications config file, which should have the same name as the .EXE file with ".config" appended to it. For example, if your application's .EXE is called MyApp.exe, the corresponding configuration file will be called MyApp.exe.config and reside in the same directory as the .EXE. This is the only file AppSettings will look in.
You can find more on these files on MSDN here:
Machine Configuration Files[^]
Application Configuration Files[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello! I need convert to(from) Julian Date Format from(to) Calendar Date.
Is there built in algorithm that allow to do this?
Now I do so:
' convert Calendar Date to Julian Date Format
Private Function GetJD(ByVal vDate As Date) As Integer
Dim y As Integer = vDate.Year
Dim m As Integer = vDate.Month
Dim d As Integer = vDate.Day
If m > 2 Then
m = m + 1
Else
y = y - 1
m = m + 13
End If
Dim JulianDate As Integer = Math.Floor(Math.Floor(365.25 * y) + Math.Floor(30.6001 * m) + d + 1720995)
JulianDate += 2 - Math.Floor(0.01 * y) + Math.Floor(0.25 * Math.Floor(0.01 * y))
Return Math.Floor(JulianDate - 0.5)
End Function
' convert Julian Date to Calendar Date Format
Private Function GetCD(ByVal JD As Integer) As Date
Dim g1, g2, g3, g4, g5 As Integer
Dim tmp As Integer = Math.Floor(((JD - 1867216.0) - 0.25) / 36524.25)
g1 = JD + 2 + tmp - Math.Floor(0.25 * tmp)
g2 = g1 + 1524.0
g3 = Math.Floor(6680 + ((g2 - 2439870) - 122.1) / 365.25)
g4 = Math.Floor(g3 * 365.25)
g5 = Math.Floor((g2 - g4) / 30.6001)
Dim d As Integer = Math.Floor(g2 - g4 - Math.Floor(g5 * 30.6001))
Dim m As Integer = Math.Floor(g5 - 1.0)
If m > 12 Then m -= 12
Dim y As Integer = Math.Floor(g3 - 4715.0)
If m > 2 Then y -= 1
If y <= 0 Then y = Abs(y - 1)
Return Date.Parse(d & "/" & m & "/" & y)
End Function
Thanks.
|
|
|
|
|
There's a prebuilt class in VB.NET named JulianCalendar that does exactly what you're looking for. JulianCalendar has several methods that'll take any conventional Gregorian date, convert it to a Julian format and send you back the result in any format you wish. I found an example for this in the MSDN2003 libraries. I'm pasting it here for your reference:
===========================================================
' The following code example displays the values of several components of a DateTime in terms of the Julian calendar.
Imports System
Imports System.Globalization
Public Class SamplesJulianCalendar
Public Shared Sub Main()
' Sets a DateTime to April 3, 2002 of the Gregorian calendar.
Dim myDT As New DateTime(2002, 4, 3, New GregorianCalendar())
' Creates an instance of the JulianCalendar.
Dim myCal As New JulianCalendar()
' Displays the values of the DateTime.
Console.WriteLine("April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar:")
DisplayValues(myCal, myDT)
' Adds two years and ten months.
myDT = myCal.AddYears(myDT, 2)
myDT = myCal.AddMonths(myDT, 10)
' Displays the values of the DateTime.
Console.WriteLine("After adding two years and ten months:")
DisplayValues(myCal, myDT)
End Sub 'Main
Public Shared Sub DisplayValues(myCal As Calendar, myDT As DateTime)
Console.WriteLine(" Era: {0}", myCal.GetEra(myDT))
Console.WriteLine(" Year: {0}", myCal.GetYear(myDT))
Console.WriteLine(" Month: {0}", myCal.GetMonth(myDT))
Console.WriteLine(" DayOfYear: {0}", myCal.GetDayOfYear(myDT))
Console.WriteLine(" DayOfMonth: {0}", myCal.GetDayOfMonth(myDT))
Console.WriteLine(" DayOfWeek: {0}", myCal.GetDayOfWeek(myDT))
Console.WriteLine()
End Sub 'DisplayValues
End Class 'SamplesJulianCalendar
'This code produces the following output.
'
'April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar:
' Era: 1
' Year: 2002
' Month: 3
' DayOfYear: 80
' DayOfMonth: 21
' DayOfWeek: Wednesday
'
'After adding two years and ten months:
' Era: 1
' Year: 2005
' Month: 1
' DayOfYear: 21
' DayOfMonth: 21
' DayOfWeek: Thursday
===========================================================
Hope this helps
PeoPLe aRe cRazY anD tiMeS aRe sTRaNGe, i'M LoCKeD iN tiGhT, i'M OuT oF raNGe, i uSeD t0 caRe BuT - thiNGs haVe chaNGeD.
|
|
|
|
|
want to insert a string in html login screen text box from vb
roy
|
|
|
|
|
Hello To All,
How can i declare a variable at runtime by a name got as string. Like:
On Runtime:
I got string "txtFldName"
So I have to declare it at runtime as:
dim txtFldName as object
Thanks in advance
Sheel
|
|
|
|
|
You can't really and there's no real reason to do so either. What are you really trying to accomplish?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
dear friend
Actually i have a smart card developed with vb application interface. It has a unique no in it. I want to pass that number in koha log in screen . Koha is a open source lib software built with cgi perl. whenever i will insert the smart card in the reader the specific id no will go to the text box of koha log in screen .
url:"http://hlt.katipo.co.nz/cgi-bin/koha/mainpage.pl"
My question is the id nomcan be shown in a textbox or label of an application in vb, the url can be invoked with the help of web browser.In the text box of that login screen i want to show the id no. HOW?
Thanks in advance
Rana
|
|
|
|
|
I have added a COM type library to my VB project and can see some COM objects in the object browser. I do this:
Dim myobj As New Plugin 'Plugin is COM object in object browser
myobj now has a number of methods available to it but it also has properties. How can I access these properties? There are no methods on the COM object to get the properties but I know they are there.
I start to type myobj. and then get a menu of methods and properties to call. What can I do with properties? One of them is called Name which must store the name of the plugin which is what I want to get.
|
|
|
|
|
If those properties are not public, and it doesn't sound like they are, then you're not going to get at them. Sure, private properties show up in the browser, but that doesn't mean you can use them.
Everything you can get to is going to be revealed when you hit the period key after typing myobj .
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
In my VB .NET project I use Access 2003 method ImportXML and ExportXML.
Is there any way that I could still use these methods without having Access 2003 installed? Could I install only some dlls in order to achieve this
|
|
|
|
|
Nope. If your going to bind your application to Access, it better be installed when you run it. You can't just use the functions you want without having everything else above that in the object tree also present.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
if i have a ascii file, example:
2 4
3 40
42 56
etc...
how to open this file?
how to show this file in listview or datagrid?
how to save in a ascii file if i have this data
thank
|
|
|
|
|
This stuff is much nicer in C++, but in VB.NET you can still use the System.IO namespace to read and write files. In fact, a quick google will overload you with the information you need.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Use the following Code. Put an AsciiFile.txt with the data
2 4
3 40
42 56
in the applications path
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents ListView1 As System.Windows.Forms.ListView
Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.ListView1 = New System.Windows.Forms.ListView
Me.ColumnHeader1 = New System.Windows.Forms.ColumnHeader
Me.ColumnHeader2 = New System.Windows.Forms.ColumnHeader
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(200, 232)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'ListView1
'
Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1, Me.ColumnHeader2})
Me.ListView1.Location = New System.Drawing.Point(8, 8)
Me.ListView1.Name = "ListView1"
Me.ListView1.Size = New System.Drawing.Size(264, 192)
Me.ListView1.TabIndex = 1
Me.ListView1.View = System.Windows.Forms.View.Details
'
'ColumnHeader1
'
Me.ColumnHeader1.Width = 120
'
'ColumnHeader2
'
Me.ColumnHeader2.Width = 135
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.ListView1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str1 As String
Dim i As Integer = -1
Dim SReadLine As Stream
SReadLine = File.OpenRead(Application.StartupPath & "\AsciiFile.txt")
Dim SrReadLine As StreamReader = New StreamReader(SReadLine, _
System.Text.Encoding.ASCII)
SrReadLine.BaseStream.Seek(0, SeekOrigin.Begin)
While (SrReadLine.Peek() > -1)
i += 1
str1 = SrReadLine.ReadLine().ToString
Dim str2() As String = str1.Split()
Me.ListView1.Items.Add(str2(0))
Me.ListView1.Items(i).SubItems.Add(str2(1))
End While
SrReadLine.Close()
End Sub
End Class
|
|
|
|
|
I think it's cool that you took the time to whip this up, but don't you think just the code that writes the file, along with a description of what it's doing, would be more helpful ? I personally thought that making the poster look for it themselves was more helpful again, given how elementary the question was.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
How can i produce an xml file from a given schema. data in the xml file should be filled from the database and the xml file should be according to the schema eg.
Schema:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="medgivande">
<xs:complexType>
<xs:attribute name="personorgnr" type="xs:positiveInteger" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
XML File:
<?xml version="1.0" encoding="ISO-8859-1"?>
<medgivande>
<medgivande personorgnr="2143544" >
<medgivande>
something like this. data "2143544" will be fetched from the data and will be written when the xml file is created.
can someone tell me how i can do this. its urgent.
|
|
|
|
|
A schema is not supposed to be used to create an XML file. You should write code to create your XML file, using the schema as a guide.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanx, but If i have a dataset with some values then can i produce xml file with the same format.
|
|
|
|
|
Simple - you've given an XML file that follows this ( simple ) Schema. So, use an XmlTextWriter to create a document that looks the same, given the data. You'd need to iterate over the rows in the dataset, using for-each, and then create the inner nodes inside the loop, opening the outer node before the loop, and closing it after.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I won't be providing any xml file, instead i want the data in the dataset to be written to xml file. now dataset has writexml method but that won't work in this case cause the output of that xml is not what i want.
|
|
|
|
|
must...use......small.....words......only
I don't know of a way to get a dataset to write to xml using a schema. But you can create your own XML file by stepping through a dataset, and writing the nodes based on your schema.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Thanx,
I date this girl for 2 years, and then the nagging starts: " i wanna know ur name": - Nitin
|
|
|
|
|
Hi all,
I am having a problem with a databound combobox in that when I save the record (ie, end current edit,update the database and accept the changes) the combobox resets its value back to the first object in the list.
Anyone else experienced this problem before?
My code for saving goes something like this.
'MsgBox("Record Saved")
'Create a new dataset to hold the changes that have been made to the main dataset.
Dim objDataSetChanges As Buckner_Intranet.dsNCR = New Buckner_Intranet.dsNCR
'Stop any current edits.
Me.BindingContext(DsNCR1, "NCR").EndCurrentEdit()
Me.BindingContext(Me.DsNCR1, "Responses").EndCurrentEdit()
'Get the changes that have been made to the main dataset.
objDataSetChanges = CType(DsNCR1.GetChanges, Buckner_Intranet.dsNCR)
'Check to see if any changes have been made.
If (Not (objDataSetChanges) Is Nothing) Then
Try
Me.BindingContext(Me.DsNCR1, "NCR").EndCurrentEdit()
Me.BindingContext(Me.DsNCR1, "Responses").EndCurrentEdit()
daNCR.Update(Me.DsNCR1, "NCR")
daResponses.Update(Me.DsNCR1, "Responses")
Catch eUpdate As System.Exception
MsgBox(eUpdate.Message)
End Try
'Commit the changes that were just merged
'This moves any rows marked as updated, inserted or changed to being marked as original values
DsNCR1.AcceptChanges()
End If
Cheers for any help you might be able to offer.
Kutz
_____________________
Don't take out the Magic Pen,
Don't draw on the Infinity Board
- Neil Young
|
|
|
|
|
How to use "Joins" in Crystal Reports.
Here is my query.
select books.bookid,books.bookname,issuebooks.issuedate,issuebooks.returndate,issuebooks.datereturned from books,issuebooks where books.bookid=issuebooks.bookid and memberid= '" & TextBox1.Text & "'"
I am making a report regarding to this query. How can i use this query in "crv.SelectionFormula" method, where crv is the name of the "Crystal Report Viewer" Control.
EsHbAn BaHaDuR
|
|
|
|
|
good news it can be done bad news is I dont use querys like that. In the report designer if you add the 2 database and link the like fields like a user ID or a author name they will show the information form both databases.
second to do the selectionformula call the like id from one of the fields I would use the one with the most fields called from it.
use the fllowing
CrystalReportViewer1.SelectionFormula ="{Customer.Cust_No } = " & CInt(txtCustNo.Text)
for string you have to use
CrystalReportViewer1.SelectionFormula ="{Customer.Cust_Name } = ' " & CInt(txtCustNo.Text) & "'"
you can put anything where txtCustno.text i normally name my strings and put them there.
James Kennelly
|
|
|
|