BTC USD 81,149.5 Gold USD 4,378.12
Time now: Jun 1, 12:00 AM

[Tutorial]Belajar Programming .NET Language

Hitman™;15552336 said:
sorry2...my bad:">

aku gne database microsoft access..

windows forms dan vb.net

harap dapat membantu
Ha kan senang dah mention... Orait nie code dia...

Code:
Dim strSql As String = "SELECT price FROM product"
Dim dtPrice As New DataTable
Dim quantity As Integer
Dim price,total As Double

Using con As New OleDbConnection(connectionStringAccess)
  con.Open()
  Using adapter As New OleDbDataAdapter(strSql, con)
    adapter.Fill(dtPrice)
  End Using
  con.Close()
End Using

If dtPrice.Rows.Count = 1 Then
  price = double.Parse(dtPrice.Rows[0]["price"].ToString());
End If

total = price * quantity

Messagebox.show("Total is :" + total.ToString());

Disebabkan access adalah database berlainan jenis.. Pada code baris atas sekali kena tulis

Code:
Imports System.Data.OleDb

Ini syntax dia.. secara jujurnya saya tak igt sangat coding vb.net, tapi caranya lebih kurang macam nie la..

So kalau ada apa2 error bagitahu, Insyallah saya cuba trace...;)

Gud luck...:D
 
Last edited:
Ha kan senang dah mention... Orait nie code dia...

Code:
Dim strSql As String = "SELECT price FROM product"
Dim dtPrice As New DataTable
Dim quantity As Integer
Dim price,total As Double

Using con As New OleDbConnection(connectionStringAccess)
  con.Open()
  Using adapter As New OleDbDataAdapter(strSql, con)
    adapter.Fill(dtPrice)
  End Using
  con.Close()
End Using

If dtPrice.Rows.Count = 1 Then
  price = double.Parse(dtPrice.Rows[0]["price"].ToString());
End If

total = price * quantity

Messagebox.show("Total is :" + total.ToString());

Disebabkan access adalah database berlainan jenis.. Pada code baris atas sekali kena tulis

Code:
Imports System.Data.OleDb

Ini syntax dia.. secara jujurnya saya tak igt sangat coding vb.net, tapi caranya lebih kurang macam nie la..

So kalau ada apa2 error bagitahu, Insyallah saya cuba trace...;)

Gud luck...:D

okeyh, bro jgn lpe jenguk2 t..

rsenyer bnyak lg yg nk tnye neh..haha.
 
TT, nak minta tolong sket...maleh nak transembelit dah, aku ada post kat web asp.net tp xda sapa jawap lagi daaa...so kalu ada sifuuu2 boleh tolong silakan laaa...

Hi everyone,

1st of all sorry for asking this, actually I manage to to child pass to parent thingy, but this time I got a problem when I need to enhance my form. Let say I need to get a Customer Name & Detail Address from a Child form, it work when I just need to return a normal value such as name or number but not for Address, the value for Address such like this :

Level 12, Menara Rainbow, Jalan Yellow, Taman Rainbow, 80400 Johor Bahru, Johor Darul Takzim. 02-10101010 / 01-11111111

* User keep the address together with the phone number

My parent form for this value is asp:TextBox with TextMode="MultiLine" Rows="4" while the data will be coming from child gridview

HTML:
<asp:TextBox ID="txtCustomerContact" runat="server" Text="Use search button only" Tooltip="Use search button only" TextMode="MultiLine" Rows="4" />

From Parent form

As I'm clicking this search icon with this parameter :

HTML:
<img alt="Search customer information" id="imgCustomer" src="/_layouts/images/search.png" border="0" onclick="var win=window.open('/_layouts/project/SearchCustomer.aspx','SearchCustomer','width=1000,height=600,scrollbars=1'); win.moveTo(screen.width/2-500,screen.height/2-300)" onmouseover="this.style.cursor='hand'" />

BTW, I got this JavaScript to do this :

HTML:
<script type="text/javascript">
    function PopulateCustomerInfo(Address) {
        document.getElementById('<%= txtCustomerContact.ClientID %>').value = Address;
	**
</script>
*** I just focus on this Adress issue only & take out the rest of code

From Child form

I need to search the specific Customer Name 1st in order to retrieve the information from it's gridview.
This is my gridview :

HTML:
<asp:gridview runat="server" ID="gvSearchCustomer" OnPageIndexChanging="gvSearchCustomer_PageIndexChanging" 
AutoGenerateColumns="False" EmptyDataText="No information available!" AllowPaging="True" CssClass="gvGridView" 
	AutoGenerateSelectButton="True" OnRowDataBound="gvSearchResult_RowDataBound" 
	onselectedindexchanged="gvSearchCustomer_SelectedIndexChanged" CellPadding="5">
	<columns>
		<asp:TemplateField HeaderText="Address" ShowHeader="true" HeaderStyle-HorizontalAlign="Left" HeaderStyle-Font-Bold="true">
			<ItemTemplate>
				<asp:Label ID="lblAddress" runat="server" Text='<%# Bind("Address") %>' Width="120px" />
			</ItemTemplate>
			<HeaderStyle Font-Bold="True" HorizontalAlign="Left" Width="150px" />
		</asp:TemplateField>
	</columns>
	<HeaderStyle CssClass="gvGridViewHeader" />
	<FooterStyle ForeColor="Black" BackColor="#C6C3C6" />
	<SelectedRowStyle ForeColor="White" Font-Bold="True" BackColor="#9471DE" />
	<RowStyle CssClass="ms-vb2" />
	<AlternatingRowStyle CssClass="ms-vb2 ms-alternating" />
</asp:gridview>

As for the script to return the selected value is :

HTML:
<script type="text/javascript">
	function callWindow(Address) {
		window.opener.PopulateCustomerInfo(Address);
		window.close();
	**

	function highlightRow(obj) {
		obj.style.cursor = 'hand';
		obj.originalcolor = obj.style.backgroundColor;
		obj.style.backgroundColor = 'yellow';
	**

	function resetHighlight(obj) {
		obj.style.backgroundColor = obj.originalcolor;
	**
</script>
And this is the code behind which I use to select the specific row :

Code:
public void gvSearchResult_RowDataBound(object sender, GridViewRowEventArgs e)
{
	if (e.Row.RowType == DataControlRowType.DataRow)
	{
		e.Row.Attributes.Add("onmouseover", "highlightRow(this)");
		e.Row.Attributes.Add("onmouseout", "resetHighlight(this)");

		string Parent = @"callWindow('" +
						((Label)e.Row.FindControl("lblAddress")).Text.Replace("'", "\\'") + "')";
		e.Row.Attributes.Add("onclick", Parent);
	**
**

My question is :

Why it's not working? All this while it's been working fine if I use the code to get the Name, Date, Currency or Number but not for this one.

***CG nyer setting akan auto change symbol ** jadi **
 
professional...need your help.

cmner aku nk wat listbox aku..kuar data dari database ms access?

then bila aku select, dye akan kuarkan harga tue.

(neh form aku)

attachment.php
 

Attachments

professional...need your help.

cmner aku nk wat listbox aku..kuar data dari database ms access?

then bila aku select, dye akan kuarkan harga tue.

(neh form aku)

attachment.php

Klau pkai datagridview dpt la tolong,.sbb listbox xpnh try lg...
 
Hitman™;15669941 said:
professional...need your help.

cmner aku nk wat listbox aku..kuar data dari database ms access?

then bila aku select, dye akan kuarkan harga tue.

(neh form aku)

attachment.php

Orait, dalam list. Disini macam-macam cara untuk upload data dari access ke listbox... Cara yang paling mudah mengunakan data source, ada juga yang suka guna foreach...

Contohnya seperti ini

Code:
DataTable dt = new DataTable();

using (OleDbConnection conn = new OleDbConnection(connection string anda))
{
using (OleDbDataAdapter adap = new OleDbDataAdapter("SELECT * FROM tbl_product, conn))
{
  adap.Fill(dt);
**
**

listBox1.datasource = dt;
//Untuk paparkan listbox, leh buat macam nie
listBox1.DisplayMember = "productName";
//Dalam masa yang sama, boleh setkan ID
listBox1.ValueMember = "productID";

Harap2 paham la...;)

Gud Luck bebeh
 
Orait, dalam list. Disini macam-macam cara untuk upload data dari access ke listbox... Cara yang paling mudah mengunakan data source, ada juga yang suka guna foreach...

Contohnya seperti ini

Code:
DataTable dt = new DataTable();

using (OleDbConnection conn = new OleDbConnection(connection string anda))
{
using (OleDbDataAdapter adap = new OleDbDataAdapter("SELECT * FROM tbl_product, conn))
{
  adap.Fill(dt);
**
**

listBox1.datasource = dt;
//Untuk paparkan listbox, leh buat macam nie
listBox1.DisplayMember = "productName";
//Dalam masa yang sama, boleh setkan ID
listBox1.ValueMember = "productID";

Harap2 paham la...;)

Gud Luck bebeh

neh vb.net language kan bro..nice.

cmner plak kalu aku nk paparkan harga dari list yg aku dh pilih tue..supaya dye terpapar kat text area bawah tue dan label price sblh kanan tue?
 
Back
Top
Log in Register