-1

im trying to figure out a way to copy the auto generated "BOM No" into another textbox "Schedule No", the problem is that the value of "BOM No:" when adding a new record is set to "New" and is only assigned a BOM number when saving the record.

I would like to find a method that would allow me to equal the value of BOM No to Schedule No so that i could use it as an identifier when loading BOM Records accodring to BOM No = Schedule No

Any help would be much appreciated :)

BOM No: = Auto Generated ID

Ron Reyes
  • 35
  • 1
  • 6
  • You should to have a block on your code when you can retrieve the generated value, so in that point you can manipulate the generated value and you can set for your target control – H. Herzl Oct 03 '16 at 03:15
  • how should i go about this if the Bom no value is generated when saving the record already? would it be possible to get a sample? :) – Ron Reyes Oct 03 '16 at 03:27
  • 1
    @RonReyes if the value is generated by the SQL, you can try http://stackoverflow.com/a/5228819/529282 otherwise you need to show the codeblock where you're generating the new value – Martheen Oct 03 '16 at 04:28
  • 1
    @RonReyes I need to see a piece of code of your form to provide a guide – H. Herzl Oct 03 '16 at 06:09
  • @Martheen its auto generated via sql, ill look into your link, thanks! :) – Ron Reyes Oct 03 '16 at 06:29
  • @H.Herzl im not sure what code block i should provide since the number auto generated via sql – Ron Reyes Oct 03 '16 at 06:44
  • Do you use an orm ? – H. Herzl Oct 03 '16 at 07:46

1 Answers1

0

I would do something like this. Have a property on the form/window (whatever it is) and when the BOM number is set, that property should be set with the value of the BOM number.

Then, bind both TextBox controls (not sure whether you are using WPF or Winforms) to that property. Both technologies can do such bindings.

Hope that helps.

  • how should i go about this if the Bom no value is only generated when saving the record? using winforms btw :) – Ron Reyes Oct 03 '16 at 03:31
  • @RonReyes Not knowing your architecture, is it possible to assign the BOM to such a variable as part of the save operation? I'm guessing a save occurs in response to a button click. When the flow returns to the form, do you have access to the BOM? I'm guessing you do if the other textbox is being assigned that value. – DavidRogersDev Oct 03 '16 at 10:22