|
You mean text ? Doesn't Windows just support that for certain locales ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hi again,
first of all thanks for ur reply.
what i mean by right-to-left not only the text. i mean the controls specially grids.
what i need exactly is a grid when i press 'Enter' or 'tab' key move to next cell from right-to-left.
thanks again
|
|
|
|
|
|
That deserves a 5 (they dont do 10's sorry :-P)
Dan
|
|
|
|
|
|
IT's for unmanaged apps, so not for VB.NET. It's not going to substitute for writing good code in the first place.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi folks,
my problem is i have string like 01/03/2000 12:23:34 i.e DD/MM/YYYY HH:MM:SS
i want to convert this as 01/mar/2000 12:23:34 to store in sql Db.
Pls help me for this issue,
advancedly thanks for replies
Thanks&Regards
RENU
|
|
|
|
|
DON345 wrote: to store in sql Db.
y u want to store such value in sql db.
stored in the default date format and then when viewing the data select the formt u want the date to be seen in..
|
|
|
|
|
Use the DateTime.ParseExact method with the format "dd/MM/yyyy HH:mm:ss" to parse the string into a DateTime value.
Don't store the value as text in the database, store it as a datetime value, and use the data format you like when you convert the value to a string after retrieving it from the database.
---
single minded; short sighted; long gone;
|
|
|
|
|
i need to design a enevlope and label design and print software in vb.i dont know how do i do it.please goto MS word->tools->letters and mailings -> envelope and labels under that labels part needs to implemented.this is used to design ur own lable sheet and print it.also need to provide feature for backgroung image.logo image and stuff.crystal reports do provide feature for designing labels but not on a run.so please help as to how it can be done.if u have any code then plz send.we can share royality
neeraj kumar
neerajkumar03@gmail.com
|
|
|
|
|
Break it down into small tasks - there are plenty of controls that will help you.
The fact that you are asking such a broad question suggests to me that you aren't up to this task but the way I would do it is.
Use a form with varying controls to get the appearance on form of what you would like, code your app so that it will take the info on screen and convert it to the relevant layout (such as you would see in MS word when you press print preview). Then use the print control to print the document.
I have not had to do this my self but the idea behind it is simple - its upto you to look for resources that tell you what controls to use or make your own.
Its your job to do this not ours if you have small specific problems such as control x wont perform functionality y and is says it should in the documentation then ask away (only after you have searched yourself though).
If it seems like I am being short with you it is because I am - I am sick of such open ended, do my work for me questions. Man up and think about the problem at hand!!!
|
|
|
|
|
Hi All
i have Posted a thread looking for an Explanation about Dal and BLL and i understand it. i but i need to see a code Template like Skeleton. to understand it more, please post a code for me or an article that uses Dal and BLL for a SQl database windows application.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
|
|
|
|
|
DotNetNuke has a reasonable well documented design for its DAL. You might want to look at that.
I'm in the process of writing some blog entries on the subject. I've only writtent he first two parts and it doesn't yet got into BLL integration but you might find something helpful. http://blog.colinmackay.net[^]
|
|
|
|
|
Thanks,man its very usefull.
Can you please Help me Convert thid to vb.net . thats the code in your Blog
public abstract class DalBase
{
private static string connectionString;
protected DalBase()
{
}
protected SqlCommand BuildCommand(string storedProcedureName)
{
SqlConnection connection = new SqlConnection(connectionString);
SqlCommand result = new SqlCommand(storedProcedureName,
connection);
result.CommandType = CommandType.StoredProcedure;
return result;
}
protected SqlDataAdapter BuildBasicQuery(string storedProcedureName)
{
SqlCommand cmd = BuildCommand(storedProcedureName);
SqlDataAdapter result = new SqlDataAdapter(cmd);
return result;
}
}
And the derived class looks like this:
public class InvoiceDal : DalBase
{
private static InvoiceDal instance;
private InvoiceDal()
{
connectionString =
ConfigurationManager.AppSettings["InvoiceConnectionString"];
}
public static InvoiceDal Instance
{
get
{
if (instance == null)
instance = new InvoiceDal();
return instance;
}
}
public DataTable GetAllProducts()
{
SqlDataAdapter dataAdapter = BuildBasicQuery("GetAllProducts");
DataTable result = new DataTable();
dataAdapter.Fill(result);
return result;
}
public DataSet GetInvoice(int invoiceNumber)
{
SqlDataAdapter dataAdapter = BuildBasicQuery("GetInvoice");
dataAdapter.SelectCommand.Parameters.AddWithValue(
"@invoiceNumber", invoiceNumber);
DataSet result = new DataSet();
dataAdapter.Fill(result);
return result;
}
public int CreateInvoice(int customerId, int billingAddressId,
DateTime date)
{
SqlCommand cmd = BuildCommand("CreateInvoice");
cmd.Parameters.AddWithValue("@customerId", customerId);
cmd.Parameters.AddWithValue("@billingAddressId",
billingAddressId);
cmd.Parameters.AddWithValue("@date", date);
cmd.Connection.Open();
int result = (int)cmd.ExecuteScalar();
cmd.Connection.Close();
return result;
}
}
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
|
|
|
|
|
Well, most of it will be the same, but without semi-colons.
You just need to know some of the keyword differences.
abstract == MustInherit
static == Shared
The curly braces denot the start and end of something. Normally the closing brace will be End Sub, End If, etc. An if statement with just one command doesn't need braces.
Variable declarations go from this:
SqlCommand command = new SqlCommand("MyCommand");
to this:
Dim command As SqlCommand = New SqlCommand("MyCommand")
Comments start with a // rather than a '
|
|
|
|
|
Thank very much
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
|
|
|
|
|
Hi Colin
i manage to Covert the Code to vb,but in other part will need your Help lets Start here
Public Class Dal
Dim connectionString As String
' <summary>
'The static initialiser will be called the first time any
' method on the class is called. This ensures that the
' connection string is available.
' </summary>
Shared Sub Dal()
DIm connectionString as String = ConfigurationManager.AppSettings["ConnectionString"]
End Sub
i had a problem with the Connection string
<br />
DIm connectionString as String = ConfigurationManager.AppSettings["ConnectionString"]<br />
The IDE tells me that "Identifier Expected"
The First one is the namespaces that needs to be imported
<br />
using System.Collections.Generic;<br />
This line it does not recognise the Generic. if i remove it "Generic" it does not Complain.
The Second Function i coverted it like this
Private Function BuildCommand(ByVal storedProcedureName As String)
' Create a connection to the database.
Dim connection = New SqlConnection(connectionString)
' Create the command object - The named stored procedure
' will be called when needed.
Dim result As New SqlCommand(storedProcedureName, connection)
result.CommandType = CommandType.StoredProcedure
Return result
End Function
i made it a Function because a sub cannot return a Value.
<br />
<br />
My Following Function is like this
' <summary>
' Builds a DataAdapter that can be used for retrieving the
' results of queries
' </summary>
' <param name="storedProcedureName">The name of the stored
' procedure</param>
' <returns>A data adapter</returns>
Private Function BuildBasicQuery(ByVal storedProcedureName As String)
Dim cmd As New SqlCommand(BuildCommand(storedProcedureName))
'Set up the data adapter to use the command already setup.
Dim result As New SqlDataAdapter(cmd)
Return result
End Function
it never Complained. and the Next one is like this
'<summary>
' A sample public method. There are no parameters, it simply
' calls a stored procedure that retrieves all the products
' </summary>
' <returns>A DataTable containing the product data</returns>
Public Function GetAllProducts()
Dim DataAdapter As New SqlDataAdapter(BuildBasicQuery("GetAllProducts"))
'Get the result set from the database and return it
Dim result As New DataTable
DataAdapter.Fill(result)
Return result
End Function
it never Complained too.
' <summary>
' A sample public method. It takes one parameter which is
'passed to the database.
' </summary>
' <param name="invoiceNumber">A number which identifies the
' invoice</param>
' <returns>A dataset containing the details of the required
' invoice</returns>
Public Function GetInvoice(ByVal invoiceNumber As Integer)
Dim DataAdapter As New SqlDataAdapter(BuildBasicQuery("GetInvoice"))
DataAdapter.SelectCommand.Parameters.AddWithValue( _
"@invoiceNumber", invoiceNumber)
Dim result As New DataSet
DataAdapter.Fill(result)
Return result
End Function
On this one i need your help, i got Stucked. the Code Complained in the Following line.
<br />
<br />
Dim DataAdapter As New SqlDataAdapter(BuildBasicQuery("GetInvoice" _<br />
, "@invoiceNumber", invoiceNumber))<br />
On the Last one, i was Completely lost
Public Function CreateInvoice(ByVal customerId As Integer, _
ByVal billingAddressId As Integer, ByVal DateTime As Date)
Dim cmd As New SqlCommand(BuildCommand("CreateInvoice"))
cmd.Parameters.AddWithValue("@customerId", customerId)
cmd.Parameters.AddWithValue("@billingAddressId")
billingAddressId)
cmd.Parameters.AddWithValue("@date",date)
cmd.Connection.Open()
dim result as Integer = (integer).cmd.ExecuteScalar()
cmd.Connection.Close()
Return result
End Function
The Compiler Complained about All the lines in this Function. the other thing is that i did not understand the Following line in the last function
<br />
int result = (int)cmd.ExecuteScalar()
i Think i you can confirm my Code, i will try to understand.
Thanks again Colin
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
|
|
|
|
|
Vuyiswamb wrote: On this one i need your help, i got Stucked. the Code Complained in the Following line.
Dim DataAdapter As New SqlDataAdapter(BuildBasicQuery("GetInvoice" _
, "@invoiceNumber", invoiceNumber))
BuildBasicQuery returns a SqlDataAdapter already, so passing it as an argument to the constructor of SqlDataAdapter is likey to cause problems. You don't need to call the constructor again as you already have an instance of the object.
So the line of code should be something like this:
Dim dataAdapter As SqlDataAdapter = BuildBasicQuery("GetInvoice")
Also note that BuildBasicQuery only takes one parameter, the name of the stored procedure. You add the parameters afterwards.
Vuyiswamb wrote: The Compiler Complained about All the lines in this Function.
VB is not supposed to be case sensitive, but that is because the IDE sorts that out for you. Perhaps that is the problem. dim should be Dim , etc.
Vuyiswamb wrote: Dim cmd As New SqlCommand(BuildCommand("CreateInvoice"))
Again, BuildCommand returns a command object already. No need to create a new one.
Vuyiswamb wrote: cmd.Parameters.AddWithValue("@billingAddressId") billingAddressId)
You have closed the bracket too early. Replace it with a comma and underscore to allow the code to progress to the next line.
Vuyiswamb wrote: int result = (int)cmd.ExecuteScalar()
i Think i you can confirm my Code, i will try to understand.
Now, this is one thing I don't know how to do in VB. (int) is the casting operator. In this case it is casting to an integer. ExecuteScalar returns an object, so it can be any type that is being returned. The code requires it to be an integer, so that is what it must be cast to.
I hope this helps.
I also hope that you are looking at the sematics (the meaning of the code) as well as the syntax (the grammar). So far you seem to have been concentrating on the syntax - which may be fine if it is easier for you to understand in VB.NET.
|
|
|
|
|
Thanks Colin and Dave. as you know am still learning how to use Dal. well as you said am a bit clumsy on my code. sorry for that. Colin am Trying convert your code from your Blog from C# to vb.net 2003.
public int CreateInvoice(int customerId, int billingAddressId,
DateTime date)
{
SqlCommand cmd = BuildCommand("CreateInvoice");
cmd.Parameters.AddWithValue("@customerId", customerId);
cmd.Parameters.AddWithValue("@billingAddressId",
billingAddressId);
cmd.Parameters.AddWithValue("@date", date);
cmd.Connection.Open();
int result = (int)cmd.ExecuteScalar();
cmd.Connection.Close();
return result;
}
}
Am trying to covert this code. amd when its in Vb, i will find my way around.
Thanks Again Colin And Dave, this is what will make me learn and be like you. if you have any Comments on how to increase my Programming skills i will apreciate it.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
|
|
|
|
|
Vuyiswamb wrote: i had a problem with the Connection string
DIm connectionString as String = ConfigurationManager.AppSettings["ConnectionString"]
The IDE tells me that "Identifier Expected"
The First one is the namespaces that needs to be imported
This needs it's namespace imported at the top of the code.
Imports System.Configuration
Vuyiswamb wrote: using System.Collections.Generic;
This line it does not recognise the Generic. if i remove it "Generic" it does not Complain.
What version of VB.NET are you using? 2003, 2005, ??? Generics only exist in 2005 (.NET 2.0) and above.
Vuyiswamb wrote: The Second Function i coverted it like this
Should be this instead:
Private Function BuildCommand(ByVal storedProcedureName As String)
' Create a connection to the database.
Dim connection As New SqlConnection(connectionString)
' Create the command object - The named stored procedure
' will be called when needed.
Dim result As New SqlCommand(storedProcedureName, connection)
result.CommandType = CommandType.StoredProcedure
Return result
End Function
Vuyiswamb wrote: My Following Function is like this
Should be this becuase BuildCommand already returns an SqlCommand object:
' Builds a DataAdapter that can be used for retrieving the
' results of queries
Private Function BuildBasicQuery(ByVal storedProcedureName As String)
Dim cmd As SqlCommand = BuildCommand(storedProcedureName)
' Set up the data adapter to use the command already setup.
Dim result As New SqlDataAdapter(cmd)
Return result
End Function
That's enough for now. Guy, the very simple mistakes you put into your version of the code have nothing to do with converting it from C# to VB.NET. They stem more from not understanding the VB.NET you're writing. You're converting the code visually, but you're not understanding the concepts that code is illustrating.
|
|
|
|
|
Vuyiswamb wrote: On the Last one, i was Completely lost
Public Function CreateInvoice(ByVal customerId As Integer, _ ByVal billingAddressId As Integer, ByVal DateTime As Date) Dim cmd As New SqlCommand(BuildCommand("CreateInvoice")) cmd.Parameters.AddWithValue("@customerId", customerId) cmd.Parameters.AddWithValue("@billingAddressId") billingAddressId) cmd.Parameters.AddWithValue("@date",date) cmd.Connection.Open() dim result as Integer = (integer).cmd.ExecuteScalar() cmd.Connection.Close() Return result End Function
The Compiler Complained about All the lines in this Function. the other thing is that i did not understand the Following line in the last function
This one just has errors all over it. The function header was declared wrong at the Date parameter, and you also didn't give it a return type. Calling BuildCommand returns an SqlCommand object, which you're passing to the constructor of another SqlCommand object, which won't work. The third mistake was trying to split a statement into multiple lines improperly, thus giving the AddWithValue method one parameter instead of the two it expected. The function parameter list being wrong automatically made the forth mistake because you were trying to use "Date" which wasn't defined. The fifth mistake is with the cast of the return Object from ExecuteScalar to an Integer. You're trying to do it using syntax that is, well, I have no idea what you were doing...
Public Function CreateInvoice(ByVal customerId As Integer, _
ByVal billingAddressId As Integer, ByVal ByVal Date As DateTime) As Integer
Dim cmd As SqlCommand = BuildCommand("CreateInvoice")
cmd.Parameters.AddWithValue("@customerId", customerId)
cmd.Parameters.AddWithValue("@billingAddressId", billingAddressId)
cmd.Parameters.AddWithValue("@date", date)
cmd.Connection.Open()
Dim result as Integer = CInt(cmd.ExecuteScalar())
cmd.Connection.Close()
Return result
End Function
In order to convert code from one language to another, you at least have to have a firm grasp of the language you're convert it TO, not necessarily the one your converting it FROM. You really need to learn the basics of VB.NET before you try and convert code from another language. If you can't write proper code in VB.NET, you're just going to write code that generates hundreds of errors where you have no idea what caused them.
|
|
|
|
|
Thank you very much
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
|
|
|
|
|
I am learning visual basics. I wrote two simple seperate projects from tutorials and want to know how how I can launch them from each other.
Thanks
|
|
|
|
|
Process.Start is how you start another program, in code.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi All,
Could someone help me understand how to pull data stored in an XML file into my Excel spreadsheet?
I have tried to treat the file as though it were text, and wrote a routine to parse it all, but it is very cumbersome to use.
There must be a better way!
Albert Giraudi
|
|
|
|
|