Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a custom screen with PO OCX

Status
Not open for further replies.

vbdbcoder

Programmer
Nov 23, 2006
241
0
16
US
I have a custom screen with PO OCX on a .NET form. I replaced the Post button with my own new Post button. I wanted to validate only the Items of the vendor can be posted. I could get to the point where the Post did not get fired even when the Items are valid. Below is my code. At the end of the code where I commented "//This event never fires" is the issue. I want "vPostButton.Value = true" to run the Post of the PO. Can you help please. Appreciate your input.

private void btnNewPost_Click(object sender, EventArgs e)
{
//vPostButton = acPO.UIAppControls["APP_Post_Button"];
//vPostButton.Value = false;

bool bOkay = true;
List<string> lstMsg = new List<string>();
string sVendor = dsPOHeader.Fields.FieldByName["VDCODE"].get_Value().ToString();

dsPODetail.GoTop();
dsPODetail.Read();

if (dsPODetail.Exists == true)
{
if (dsPODetail.Fetch())
{
do
{
string sItem = dsPODetail.Fields.FieldByName["ITEMNO"].get_Value().ToString();
string sUnitCost = dsPODetail.Fields.FieldByName["UNITCOST"].get_Value().ToString();

if (Is_Item_In_VendorItems(sItem, sVendor) == false)
{
string sMsg = "Item : " + sItem;
lstMsg.Add(sMsg);
bOkay = false;
}
} while (dsPODetail.Fetch());
}
}

if (bOkay == false)
{
string sMsg = "";
for (int i = 0; i < lstMsg.Count; i++)
{
sMsg = sMsg + lstMsg + "\n";
}
MessageBox.Show("Can't Post. The below PO line items are not for Vendor " + sVendor + "\n\n" + sMsg);

// vPostButton = Accpac acPO.UIAppControls["APP_Post_Button"].GetControl();
vPostButton.Value = false; //This event never fires
}
else
{
//vPostButton = acPO.UIAppControls["APP_Post_Button"];
vPostButton.Value = true; //This event never fires
}
}
 
I can't read your code - use code tags.

Did you do anything to the original button like disable it or make it not visible? I had a problem similar to this (might have been the PO form - don't remember) but I had to set the original button's .left value to a negative number and NOT set macrovisible to false because the underlying code wouldn't work. I also likely set the tabstop of the button to false OR I set up code so if the user tabbed into the original button that I set focus on my replacement button.
 
I need bit more details, from your side

I can suggest to use using vb control extenders (it's vb6-sdk coding)
and

capture "On record changing" event to customize for your requirement..


Thanks
Ram
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top