|
I have a dropdown list and when I select something on it I want another dropdown to be populated with values.
The dropdown is like this: Book
Title
If you select Title I want it to populate another dropdown which would contain a list of titles.
These values are all contained in tables.
Has anyone any code that might be of use in this.
Thanks,
macca
|
|
|
|
|
I dunno in which platform you are working either vb/.net! write your code in the click event of the combo box. and populate the records into another combo box.
|
|
|
|
|
I am trying to update the values of cells inside a datagrid at my windowsForms Project.
it always gives same error.
Error is : "Invalid object name "TriggerMessages'
at System.Data.Common.DBDataAdapter.Update(DataRow[] datarows,dataTableMapping tableMapping)
at System.Data.Common.DBDataAdapter.Update(Dataset dataset,String srcTable)
I need a WindowsForms vb.net dataGrid that user can make update and delete operations on it.I googled and also searched codeproject but could not find the thing i need.
Here is my codes..would someone tell me the problem and the solution..
Thanx in advance..
-----------------------------------
Private ds As DataSet
Public updateRowNo As Integer
Private connString As New String("Server=localhost;Database=Northwind;uid=sa;pwd=;")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As New SqlConnection(connString)
Dim da As New SqlDataAdapter("SELECT FirstName,LastName FROM Employees", conn)
ds = New DataSet
Try
conn.Open()
da.Fill(ds, "Employees")
dgrid.SetDataBinding(ds, "Employees")
'dgrid.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.ToString())
End Try
conn.Close()
dgrid_CurrentCellChanged(sender, e)
End Sub
---------------------------------
Private Sub update_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles update.Click
updateRowNo = dgrid.CurrentRowIndex
recordUpdate(updateRowNo)
End Sub
---------------------------------
Private Sub recordUpdate(ByVal updateRowNosu As Integer)
Dim conn As New SqlConnection(connString)
Dim da As New SqlDataAdapter("SELECT FirstName,LastName FROM Employees", conn)
da.UpdateCommand = New SqlCommand("UPDATE Employees SET LastName=@LastName,FirstName=@FirstName", conn)
da.UpdateCommand.Parameters.Add("@LastName", SqlDbType.NVarChar, 20, "LastName")
da.UpdateCommand.Parameters.Add("@FirstName", SqlDbType.NVarChar, 20, "FirstName")
Try
conn.Open()
Dim myRow As DataRow = ds.Tables("Employees").Rows(updateRowNo)
'Dim myRow As DataRow = ds.Tables(0).Rows(updateRowNo)
'da.Update(ds.Tables(0))
da.Update(ds, "Employees")
Catch ex As Exception
MsgBox(ex.ToString())
End Try
conn.Close()
End Sub
--------------------
One dataGrid and one button on the form.DataGrid's name is dgrid and buttons name is update.
--MCAD-junior coder--
|
|
|
|
|
Hi,
I have following function in vb.net:
Private Function StreamToString(ByVal strm As UCOMIStream) As String
Dim iptr As IntPtr
Dim s As String
GetHGlobalFromStream(strm, iptr)
s = Marshal.PtrToStringAnsi(iptr)
s = Marshal.PtrToStringAuto(iptr)
Return s
End Function
I am trying to convert html in to string from a stream. Everything works fine but GetHGlobalFromStream(strm, iptr)
does not work in vb.net.
I have imported OleLib.tlb also in the project. But i can not run the code.
If someone has ever programmed to get convert html of a page from a stream please answer my question. Its very urgent.
Thanks.
|
|
|
|
|
Dear Friends
I have a program to send email in VB.NET my programm is running well it sents the mail file in c:\Inetpub\mailroot\Queue but from there it is not sending to the recepient. the mail files are still in Queue folder even i am connected to the internet and even my smtp service is running well.
please help me. your quick response will be highly appreciated.
Thanks
Patel Murtuza
|
|
|
|
|
Hi,
I have a small problem in displaying time AM/PM format in VB.NET.
format(datetime.Now,"hh.mm.ss AMPM")
This is the code i have used but it is not displaying in AMPM format.
Pls give me some suggestion.
Thanks
Mahesh
|
|
|
|
|
use this format
Label.Text = Format(DateTime.Now,"dd'/'MM'/'yyyy hh':'mm':'ss tt")
for more format see msdn
Ishak
|
|
|
|
|
search for this:
DateTime.Now().ToString(...)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Dear All,
How can we restict the TextBox to enter only specified language(other than english like arabic or etc..)in vb.net,means that can be access only arabic charecters
Ishak
|
|
|
|
|
You can't. The character set used depends on the Input Local specified in the Regional Settings control panel. The language itself can't be restricted.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Please help me.
I use the SHSetFolderPath function to Assigns a new path to a system folder through its CSIDL.But it return fail.The source code as follow:
HRESULT hr = NULL;
HINSTANCE hLib = NULL;
typedef HRESULT (WINAPI *SHSetFolderPath(int,HANDLE,DWORD,WCHAR*);
hLib = LoadLibrary("shell32.dll");
if(hLib)
{
SHSetFolderPath lpfSHSetFolderPath;
lpfSHSetFolderPath = (SHSetFolderPath)GetProcAddress(hLib,(LPTSTR)232);
hr = lpfSHSetFolderPath(CSIDL_FAVORITES,NULL,0,L"E:\\TestFolder");
}
The "hr" return value is not S_OK,why?
Thanks
|
|
|
|
|
Why are you asking questions about and posting C# code in the VB.NET Forum?
I can tell you you're calling this function the hard way.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sorry.
I have made a mistake.I wanted to ask the question in the C++ Forum.
|
|
|
|
|
There is some images that do not be needed.
How to remove them from resources file?
|
|
|
|
|
What version of VB.NET are you talking about? In 2005, just double click MyProject, click on the Resources tab on the left, right click the resource line that has the image and click on Delete.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I tried creating Splash screen in VB.NET. But when i close it main form also gets closed. I tried opening it from sub main() but same problem. Can any body tell how to create splash screen in VB.NET.
Niranjan
|
|
|
|
|
ok splash screens are easy
on the form that serves as the splash screen, put a timer control, then turn enabled to true in the properties, and the interval to whatever you want. 1000=1sec.double click on the timer control and enter me.close
Me tells the program that it is only dealing with that one form and close closes the form. If you use End it will close the whole program.
BINARY
|
|
|
|
|
In VB.NET if u close first screen even with ME.Close() it closes all other forms. I.e if i open main from from splash screen then it will close that form also....
|
|
|
|
|
set it up with the timer on the splash screen, then create a module with something like this
Module Startup<br />
<br />
Public Sub Main()<br />
Dim frmSplash As New frmSplash<br />
Dim frmMain As New frmMain<br />
<br />
frmSplash.ShowDialog()<br />
frmMain.ShowDialog()<br />
<br />
End Sub<br />
End Module
make sure that in the timers tick event you put me.close, oh and change the startup object to SubMain and everthing should be fine.
BINARY
|
|
|
|
|
Search the articles for "Splash Screen" and you'll find a bunch of examples of how to do it the "right way".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I just wrote a program and was wondering how to change the appearance of the exe file in the start menu such as adding an Icon.
BINARY
|
|
|
|
|
Hye
Right click on the project and go to properties. In the build option you can change the icon. As far the links in Start menu are concerned. Add a deployment project. and create a short cut in User Program menu for your output exe. and in the short cut properties you can change the icon.
cheers....
|
|
|
|
|
hi there,
Can someone help with this.
Syntax error in INSERT INTO statement.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.
Source Error:
Line 84: strsqlinsert = "INSERT INTO Transmittal(Action, Copies, Drw_Doc_Num, Kind_Attn, Project_Name, Referenced_To, Rev_Num, Title, Username)" + "VALUES('" + TextBox9.Text + "', '" + TextBox7.Text + "', '" + TextBox6.Text + "', '" + TextBox4.Text + "', '" + TextBox2.Text + "', '" + TextBox3.Text + "', '" + TextBox8.Text + "', '" + TextBox5.Text + "', '" + TextBox1.Text + "' )"
Line 85: TransDataAdapter.InsertCommand.CommandText = (strsqlinsert)
Line 86: TransDataAdapter.InsertCommand.ExecuteNonQuery()
Line 87: TransConnection.Close()
Line 88: End Sub
Source File: C:\Inetpub\wwwroot\OM\trans1.aspx.vb Line: 86
Stack Trace:
[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +154
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +54
OM.trans1.Button1_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\OM\trans1.aspx.vb:86
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1263
|
|
|
|
|
manik nath wrote:
[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
insead of writing the long codes you can just work on insert statement. if you could post the value of strsqlinsert variable then we could suggest you
some thing better and proper
|
|
|
|
|
well rizwan,
here's the value of strsqlinsert
strinsert = "INSERT INTO Transmittal(ReferencedTo, Title, NumberofCopies, Username, ProjectName, KindAttn, RevisionNumber, Action, DrawingDocumentNumber)" + "VALUES ('" + TextBox3.Text + "', '" + TextBox5.Text + "', '" + TextBox9.Text + "', '" + TextBox1.Text + "', '" + TextBox2.Text + "', '" + TextBox4.Text + "', '" + TextBox10.Text + "', '" + TextBox11.Text + "', '" + TextBox7.Text + "' )"
it doesn't come in one line here.
help me if you could.
|
|
|
|